File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -1346,16 +1346,15 @@ parameter in :meth:`TarFile.add`::
13461346 tar.add("foo", filter=reset)
13471347 tar.close()
13481348
1349- How to create and write the archive to stdout using
1349+ How to create and write an archive to stdout using
13501350:data: `sys.stdout.buffer <sys.stdout> ` in the *fileobj * parameter
13511351in :meth: `TarFile.add `::
13521352
1353- import tarfile
13541353 import sys
1355- files = ["foo.txt", "bar.txt", "quux.txt"]
1356- with tarfile.open("sample.tar.gz", "w| gz", fileobj=sys.stdout.buffer) as tar:
1357- for file in files :
1358- tar.add(file )
1354+ import tarfile
1355+ with tarfile.open("sample.tar.gz", "w: gz", fileobj=sys.stdout.buffer) as tar:
1356+ for name in ["foo", "bar", "quux"] :
1357+ tar.add(name )
13591358
13601359.. _tar-formats :
13611360
You can’t perform that action at this time.
0 commit comments