#-*-coding:utf-8-*- import sys import time def check(): p = 0
while True: f = open("log.txt", "r+") f1 = open("result.txt", "a+") #定位指針 f.seek(p, 0) filelist = f.readlines() if filelist: for line in filelist: #對行內容進行操作 f1.write(line*10) print line #獲取文件當前位置 p = f.tell()
print 'now p ', p f.close() f1.close() time.sleep(1) if __name__ == '__main__': check()