Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6f0abf

Browse files
committed
More typical sample invocation of tarfile.
1 parent 712d2b4 commit e6f0abf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Doc/whatsnew/3.2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ function can return *None*::
13441344
tarinfo.uname = 'monty' # redact the user name
13451345
return tarinfo
13461346

1347-
>>> with tarfile.TarFile(name='myarchive.tar', mode='w') as tf:
1347+
>>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:
13481348
for filename in glob.glob('*.txt'):
13491349
tf.add(filename, filter=myfilter)
13501350
tf.list()

0 commit comments

Comments
 (0)