for line in ftpr: and fptr.tell()

Jamey Cribbs jcribbs at twmi.rr.com
Mon Nov 3 21:25:48 EST 2003


Is it still true that you can't do:

for line in fptr:
     pos = fptr.tell()


Because you won't get the correct file position from tell().  I think it 
had something to do with the file iterator caching several kb of the 
file when it first started the for loop.

Is there a fix/work-around for this?

Thanks!

Jamey Cribbs





More information about the Python-list mailing list