Staging: this is not the live site, pydocs.org.
Data Compression and Archiving
The TarFile Class provides an interface to tar archives.
Changed in 3.2, 3.5, 3.6, 3.13
- 3.2: Use 'surrogateescape' as the default for the errors argument.
- 3.5: The 'x' (exclusive creation) mode was added.
- 3.6: The name parameter accepts a path-like object.
- 3.13: Add the stream parameter.
Members of TarFile
a
- add
- Add the file 'name' to the archive.
- addfile
- Add the TarInfo object 'tarinfo' to the archive.
e
- errorlevel
- If errorlevel is 0, errors are ignored when using TarFile.extract() and TarFile.extractall().
- extract
- Extract a member from the archive to the current working directory, using its full name.
- extractall
- Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards.
- extractfile
- Extract a member from the archive as a file object.
- extraction_filter
- The extraction filter used as a default for the filter argument of extract() and extractall().
g
- getmember
- Return a TarInfo object for member 'name'.
- getmembers
- Return the members of the archive as a list of TarInfo objects.
- getnames
- Return the members of the archive as a list of their names.
- gettarinfo
- Create a TarInfo object from the result of os.stat or equivalent on an existing file.
l
- list
- Print a table of contents to sys.stdout.
n
- next
- Return the next member of the archive as a TarInfo object, when TarFile is opened for reading.
o
- open
- Open a tar archive for reading, writing or appending.
p
- pax_headers
- A dictionary containing key-value pairs of pax global headers.