Newbie question about file input
Grant Edwards
grante at visi.com
Mon Aug 16 12:43:02 EDT 2004
On 2004-08-16, Elcio Ferreira <elciof at gmail.com> wrote:
>> while 1:
>> line = zf.readline()
>> if not line:
>> break
>
> Newbie's question:
>
> Isn't it a strange way to do a loop? Create a loop with a foo
> condition and use an if to break it?
>
>=====
> line=zf.readline()
> while line:
> . . .
> line=zf.readline()
>=====
>
> Isn't this code much more easy to understand?
I prefer this:
for line in xf:
....
--
Grant Edwards grante Yow! I'm rated PG-34!!
at
visi.com
More information about the Python-list
mailing list