On 2007-11-21, braver <[EMAIL PROTECTED]> wrote:
> 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?
Yes.

>>> f = file('jopa')
>>> f.read()
'jopa\n'

...and in both Ruby and Python you are at EOF by definition.
There's no need to check.

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to