https://pantsbuild.org/ logo
#general
Title
# general
r

rough-minister-58256

09/21/2015, 11:56 PM
Copy code
>>> import tarfile
>>> with tarfile.open('/tmp/xyz.tar.gz', 'w:gz') as t:
...   t.add('/tmp/pants.out')
... 

[illuminati tmp]$ ls -alh /tmp/xyz.tar.gz
-rw-r--r--  1 kwilson  wheel    36K Sep 21 16:54 /tmp/xyz.tar.gz

>>> with tarfile.open('/tmp/xyz.tar.gz', 'w:gz') as t:
...   t.add('/tmp/pants.out')
...   t.add('/tmp/pants.out')
...   t.add('/tmp/pants.out')
...   t.add('/tmp/pants.out')
... 

[illuminati tmp]$ ls -alh /tmp/xyz.tar.gz
-rw-r--r--  1 kwilson  wheel   141K Sep 21 16:54 /tmp/xyz.tar.gz