How to "gunzip-iterate" over a file?

Paul Rubin http
Wed Jul 29 21:04:47 EDT 2009

Robert Kern <robert.kern at> writes:
> f ='filename.gz')
> for line in f:
>      print line

or use to read n uncompressed bytes from f.  Note that
the standard iterator (which iterates over lines) can potentially
consume an unbounded amount of memory if the file contains no newlines.

More information about the Python-list mailing list