eof

braver deliverable at gmail.com
Wed Nov 21 18:17:14 EST 2007


I'd like to check, for a filehandle f, that EOF has been reached on
it.  What's the way to do it?  I don't want to try/except on EOF, I
want to check, after I read a line, that now we're in the EOF state.
In Ruby it's f.eof:

In Ruby:
>> f = File.open("jopa")
=> #<File:jopa>
>> f.read()
=> "jopa\n"
>> f.eof
=> true

Is there a Python analog?

Cheers,
Alexy



More information about the Python-list mailing list