首页 > 代码库 > Python__文件习题

Python__文件习题

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)

 

Python__文件习题