Commit e6f0abf3 authored by Raymond Hettinger's avatar Raymond Hettinger

More typical sample invocation of tarfile.

parent 712d2b4f
...@@ -1344,7 +1344,7 @@ function can return *None*:: ...@@ -1344,7 +1344,7 @@ function can return *None*::
tarinfo.uname = 'monty' # redact the user name tarinfo.uname = 'monty' # redact the user name
return tarinfo 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'): for filename in glob.glob('*.txt'):
tf.add(filename, filter=myfilter) tf.add(filename, filter=myfilter)
tf.list() tf.list()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment