File-like objects for reading zip files?

Greg Landrum gReGlAnDrUm at earthlink.net
Sat Jun 30 11:48:23 EDT 2001


Hi,

I have a .zip archive containing a very large text file (~2.3 MB compressed,
~520MB uncompressed).  I'd like to have a file-like object for working with
this file so that I never need to uncompress it.  In case this isn't clear
enough, I'd like to be able to do something like this:

import magiczipthing
f = magiczipthing.FileLikeObject('bigfile.zip','r')
l = f.readline()
while l:
    process_line(l)
    l = f.readline()

>From my perusal of the docs, it doesn't look like the zipfile module
supports this type of interaction.

Is there any way to accomplish this task?

Thanks,
-greg





More information about the Python-list mailing list