python 文件监控

from time import sleep

with open("test.txt","r",encoding="utf-8") as f:
    
    while True:
        sleep(1)
        data = (f.readline()).strip()
        if data != "":print(data)

你可能感兴趣的:(python,python,监控)