标签:
1 #-*-coding:utf-8-*- 2 import sys 3 import time 4 5 def check(): 6 p = 0
7 while True: 8 f = open("log.txt", "r+") 9 f1 = open("result.txt", "a+") 10 11 #定位指针 12 f.seek(p, 0) 13 14 filelist = f.readlines() 15 if filelist: 16 for line in filelist: 17 #对行内容进行操作 18 f1.write(line*10) 19 print line 20 21 #获取文件当前位置 22 p = f.tell()
23 print ‘now p ‘, p 24 f.close() 25 f1.close() 26 time.sleep(1) 27 28 if __name__ == ‘__main__‘: 29 check()
标签:
原文地址:http://www.cnblogs.com/wowoo1121/p/5379017.html