read large zip file
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Apr 8 00:44:38 EDT 2008
En Tue, 08 Apr 2008 00:10:01 -0300, John Nagle <nagle at animats.com>
escribió:
> Gabriel Genellina wrote:
>> En Sun, 06 Apr 2008 19:20:31 -0300, Brian Blais <bblais at bryant.edu>
>> escribió:
>>
>>> I need to read a series of large zipfiles (which only contain one
>>> large text file), and I noticed that the zipfile module:
>>
>> Use the module from the 2.6 version; it appears to work fine even on
>> Python 2.4 (see this thread
>
> It's easier than that:
>
> fd = gzip.open(filename, 'rb')
> for line in fd :
> processline(line)
>
> This works even in Python 2.4. I use this routinely for processing big
> log files.
That works for gzipped files, but the OP said "zipfiles" which aren't the
same thing. It might be a generic term too - we'll have to wait until he
gives any feedback...
--
Gabriel Genellina
More information about the Python-list
mailing list