Recently in the Learning Python teacher assigned a job to write a file reader:
Requirements are as follows:
Page UP and down
Automatic page reading and manual control
Actual combat:
The code is as follows:
Timetl = [] readers (path,lines=,auto=,times=): (path,) F: f.seek (,) last = f.tell () f.seek () i (lines): (F.readline ()) tl.append (F.tell ()) Auto == : f.tell () < last: i (lines): (F.readline ()) tIme.sleep (Times) : f.tell () < last: contorl = () contorl == contorl == : () contorl == contorl ==: i (lines): (F.readline ()), tl.append (F.tell ()) contorl == contorl ==: (TL) == : () (TL) == : f.seek () i (lines): (F.readline ()), tl.pop () : f.seek (tl[-]) i (lines): (F.readliNE ()), tl.pop () () __name__ == : readers ()
This article is from the "end of the school" blog, please be sure to keep this source http://280872.blog.51cto.com/270872/1940676
Python Writing file Reader