checking for end of file?

Constantinos A. Kotsokalis C.Kotsokalis at ece.ntua.gr
Thu Sep 30 19:32:04 EDT 1999


On Thu, 30 Sep 1999 23:07:14 GMT, abkout at my-deja.com wrote:
>I've probably missed something obvious, but how
>can I test for an end of file in a Python script?
>(without attempting to read something from it)

Well this definitely is architecture dependent and
won't always work in some architectures (because of
file locking stuff) but you can os.stat() the
file and keep your current position somewhere.
os.stat() returns a list with stat'd file attributes, one
of which is byte size.

-- 
Constantinos A. Kotsokalis - C.Kotsokalis at ece.ntua.gr - NTUA - ECE Dept.
"Writing software is more fun than working."




More information about the Python-list mailing list