mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
More typical sample invocation of tarfile.
This commit is contained in:
parent
712d2b4f4b
commit
e6f0abf34a
1 changed files with 1 additions and 1 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue