pythonbeginner

Tarfile Compression

Advanced Python pattern: tarfile-compression

python
import tarfile
from pathlib import Path

Path('b.txt').write_text('data')
with tarfile.open('archive.tar.gz', 'w:gz') as tf:
    tf.add('b.txt')
print('archive.tar.gz created')

Use Cases

  • advanced programming
  • patterns

Tags

Related Snippets

Similar patterns you can reuse in the same workflow.