]> granicus.if.org Git - python/commitdiff
More typical sample invocation of tarfile.
authorRaymond Hettinger <python@rcn.com>
Thu, 27 Jan 2011 07:34:45 +0000 (07:34 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 27 Jan 2011 07:34:45 +0000 (07:34 +0000)
Doc/whatsnew/3.2.rst

index 8901b5ccbb3e7792c9e7b983b20a0ee8e93c16e9..94257ae350f37e8efeda13cd777f28c298c75fe5 100644 (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()