Using Python for file packing

Scott David Daniels Scott.Daniels at Acm.Org
Mon Jun 29 17:16:34 EDT 2009


Aaron Scott wrote:
>> Do you mean like a zip or tar file?
>>
>> http://docs.python.org/library/zipfile.htmlhttp://docs.python.org/library/tarfile.html
>>
> 
> I had no idea you could access a single file from a ZIP or TAR without
> explicitly extracting it somewhere. Thanks.
You will find the zip format works better if you are compressing.  The
zipfile compression is per file in the archive, rather than applied to
the entire archive (as in tarfile).  The results of the tar format
decision is that extracting the last file in a .tgz (.tar.gz) or
.tar.bz2 (sometimes called .tbz) requires the expansion of the entire
archive, while extraction on a .zip is reposition, read, and possibly
expand.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list