zipfiles module... read a file from archive

Kragen Sitaker kragen at pobox.com
Wed Mar 20 15:43:25 EST 2002


Danny Pansters <danny at ricin.com> writes:
> I would like to know if reading from a zipfile is only possible by 
> reading its entrire contents in memory (the read() method of the 
> ZipFile class) or is there a way to do this, say, line by line.

I think you'll have to modify the ZipFile class.

> So, am I stuck with having every file in the zip archive in memory to 
> be able to write them to disk (would yield some limits just for 
> safety) or can I do it in chunks somehow?

You might consider using ulimits (setrlimit) for safety limits.  The
Python interface to ulimits is in the standard library "resource"
module.




More information about the Python-list mailing list