EOF

Daley, MarkX markx.daley at intel.com
Fri Jul 7 15:51:40 EDT 2000


A better way is this:

f = open("file")
line = f.readline
while line:
	<process here>
	line = f.readline

This way, you're not testing truth against a known true.

- Mark

-----Original Message-----
From: Carlos Eberhardt [mailto:ceberhardt at itradar.com]
Sent: Friday, July 07, 2000 12:42 PM
To: python-list at python.org
Subject: Re: EOF


Not sure if it fits what you're doing, but one way would be
f = open("file")
while 1:
    line = f.readline()
    if not line:
        break

'Course, I'm new at this, so that might be a really awful way to do it, but
it's worked for me. :)

"fae" <fae at sis.it> wrote in message news:396623EE.211B14E9 at sis.it...
> Sorry,
>    how can I test if I reached the end of file ?
>
> thanks ,
>    Leonardo.
>









More information about the Python-list mailing list