iterating over lines in a file
Remco Gerlich
scarblac-spamtrap at pino.selwerd.nl
Thu Jul 20 06:16:33 EDT 2000
Kirill Simonov wrote in comp.lang.python:
> On Wed, Jul 19, 2000 at 07:14:15PM -0500, nobody wrote:
>
> > while (line = <FILE>) { block; }
>
> The easiest way:
>
> for line in file.readlines():
> block
But that would read the whole thing into memory, and he doesn't want that.
Wouldn't an xreadlines() method on file objects be cool?
--
Remco Gerlich, scarblac at pino.selwerd.nl
12:15pm up 136 days, 24 min, 6 users, load average: 0.35, 0.21, 0.15
More information about the Python-list
mailing list