1 import time 2 with open(‘test.txt‘,‘rb‘) as f: 3 f.seek(0) 4 while True: 5 line = f.readline() 6 if line: 7 print(line.decode(‘utf-8‘),end=‘‘) 8 else: 9 time.sleep(0.5)
时间: 2024-10-22 06:36:13
1 import time 2 with open(‘test.txt‘,‘rb‘) as f: 3 f.seek(0) 4 while True: 5 line = f.readline() 6 if line: 7 print(line.decode(‘utf-8‘),end=‘‘) 8 else: 9 time.sleep(0.5)