Using Python for file packing

MRAB python at mrabarnett.plus.com
Tue Jun 30 00:18:30 CEST 2009


Scott David Daniels wrote:
> 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.
> 
If the audio is already compressed then a zipfile probably won't be able
to compress it any more.



More information about the Python-list mailing list