compression level with tarfile (w:gz) ?

Esmail ebonak at
Mon Aug 10 15:37:14 CEST 2009

Benjamin Kaplan wrote:
> On Mon, Aug 10, 2009 at 8:50 AM, Esmail<ebonak at> wrote:
>> I was wondering if it possible to specify a compression level when I
>> tar/gzip a file in Python using the tarfile module. I would like to
>> specify the highest (9) compression level for gzip.
>> Ideally:
>>   t ='.tar.gz', mode='w:gz:9')
> Looking at the tarfile docs, it seems that there are tarfile.gzopen
> and tarfile.bz2open functions that have a compresslevel parameter that
> defaults to 9. You can't append using those functions but you can read
> and write.

Hi Benjamin,

I can't find tarfile.gzopen  in the tarfile docs, I'm looking here:

Am I looking at the wrong page?



More information about the Python-list mailing list