File-like objects for reading zip files?

Volucris volucris at hotmail.com
Sat Jun 30 17:12:18 EDT 2001


I haven't heard of anything like that. You might want to check out the zlib
module. It's got some compression stuff in there. Zips can have multiple
files in them so your code would have to have a way to choose which file you
want to access.

--

Volucris (a) hotmail.com
"Eu não falo uma única palavra do português."

"Greg Landrum" <gReGlAnDrUm at earthlink.net> wrote in message
news:9hks27$549$1 at slb2.atl.mindspring.net...
> 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