| 1234567891011121314151617 |
- import time
- import os
- def tail_f(filename):
- with open(filename, 'r', encoding='utf-8') as f:
- # Move the cursor to the end of the file
- f.seek(0, os.SEEK_END)
- while True:
- line = f.readline()
- if not line:
- time.sleep(0.1) # Sleep briefly
- continue
- print(line, end='')
- if __name__ == "__main__":
- log_file = '购买日志log/购买日志.log'
- tail_f(log_file)
|