Newbie question about file input

Elcio Ferreira elciof at gmail.com
Mon Aug 16 12:22:39 EDT 2004


> 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?

-- 
--
Um [ ]!

Elcio
http://elcio.locaweb.com.br/
http://www.tableless.com.br/
http://www.atipico.com.br/



More information about the Python-list mailing list