More typical sample invocation of tarfile.

This commit is contained in:
Raymond Hettinger 2011-01-27 07:34:45 +00:00
parent 712d2b4f4b
commit e6f0abf34a
1 changed files with 1 additions and 1 deletions

View File

@ -1344,7 +1344,7 @@ function can return *None*::
tarinfo.uname = 'monty' # redact the user name
return tarinfo
>>> with tarfile.TarFile(name='myarchive.tar', mode='w') as tf:
>>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:
for filename in glob.glob('*.txt'):
tf.add(filename, filter=myfilter)
tf.list()