Files, Seek, and Readlines. A newbie question
John Purser
NO_SPAM_jmpurser2 at attbi.com
Mon Apr 1 10:58:43 EST 2002
Hello,
I'm using a large (>120,000 lines) sorted ASCII text file as an index. I
started running into problems as soon as I began to use the .seek() to
position before a read. Even when not opened as a binary file seek moves by
bytes not lines. Is there a line oriented seek version? Is there a better
way to get to line 50 than:
myFile.seek(0)
myFile.readlines(49)
Record = myFile.readline()
?
Thanks,
John Purser
More information about the Python-list
mailing list