file object and eof
Steve Holden
steve at holdenweb.com
Tue Aug 15 16:31:42 EDT 2006
KraftDiner wrote:
[...]
> how about?!:
>
> def eof(fileobj):
> curloc = fileobj.tell()
> ofloc = fileobj.seek(0,2)
> fileobj.seek(curloc, 0)
> if ofloc >= curloc:
> return True
> return False
>
Ignoring the errors in your file manipulation, think about replacing the
last three lines with
return ofloc >= curloc
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list
mailing list