I am parsing the file and should keep track of where I am in the file ... let's say I have a test.txt file and I make a while loop that constantly reads the data as each line is written to the file. In the event of a failure, I mark my position in another file using the tell () method of the file. Is there a way to mark a line and return to that line position or do I need to track bytes with a message only?
f = open('test.txt')
pos = open('pos.txt', 'w')
f.seek(pos)
while 1:
readline(f)
pos.write(f.tell())
Update: files about 1 GB each
source
share