most idiomatic looping over a file?

Tom Verbeure tom_verbeure at hot.nospam.mail.com
Wed May 28 21:24:01 EDT 2003


I usually do this:

for line in myFile:
    ...

I think this was a fairly recent addition though.

Tom



"Mark Harrison" <mh at pixar.com> schreef in bericht
news:x5dBa.1258$aV7.1171 at newssvr19.news.prodigy.com...
> What's the most idiomatic way to loop over input
> one line at at time, like the C code
>
> while ((s = fgets(...)) != NULL) { ... }
>
> Many TIA,
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios






More information about the Python-list mailing list