PyDocs

Nav

Data Compression and Archiving

TarFile.extract

tarfile

method of TarFile (source)
  • TarFile.extract(member, path='', set_attrs=True, *, numeric_owner=False, filter=None)
Extract a member from the archive to the current working directory,
using its full name. Its file information is extracted as accurately
as possible. 'member' may be a filename or a TarInfo object. You can
specify a different directory using 'path'. File attributes (owner,
mtime, mode) are set unless 'set_attrs' is False. If 'numeric_owner'
is True, only the numbers for user/group names are used and not
the names.

The 'filter' function will be called before extraction.
It can return a changed TarInfo or None to skip the member.
String names of common filters are accepted.
Changed in 3.2, 3.5, 3.6, 3.12
  • 3.2: Added the set_attrs parameter.
  • 3.5: Added the numeric_owner parameter.
  • 3.6: The path parameter accepts a path-like object.
  • 3.12: Added the filter parameter.
0 Examples
No examples for tarfile/TarFile.extract.
See Also
No see-alsos for tarfile/TarFile.extract
0 Notes
No notes for TarFile.extract