More typical sample invocation of tarfile.
This commit is contained in:
parent
712d2b4f4b
commit
e6f0abf34a
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue