file object and eof
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Tue Aug 15 13:07:57 EDT 2006
In <1155660586.941712.114410 at b28g2000cwb.googlegroups.com>, KraftDiner
wrote:
> I open a file in python by
> f = open('filename', mode='rb')
>
> how can I tell if I am at the end of file?
> f.eof() isn't implmented.
>
> How can I implement its functionallity?
Try to read something. If the empty string is returned you are at the end
of the file. Or write a function that uses `os.path.filesize()` and the
`tell()` method of the file.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list