1. 程式人生 > >Python__文件習題

Python__文件習題

習題 utf log see color pan utf-8 end port

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__文件習題