tarfile.TarFile.getmember()

TarFile.getmember(name) Return a TarInfo object for member name. If name can not be found in the archive, KeyError is raised. Note If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version.

tarfile.TarFile.extractfile()

TarFile.extractfile(member) Extract a member from the archive as a file object. member may be a filename or a TarInfo object. If member is a regular file or a link, an io.BufferedReader object is returned. Otherwise, None is returned. Changed in version 3.3: Return an io.BufferedReader object.

tarfile.TarFile.getnames()

TarFile.getnames() Return the members as a list of their names. It has the same order as the list returned by getmembers().

tarfile.TarFile.getmembers()

TarFile.getmembers() Return the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive.

tarfile.TarFile.extract()

TarFile.extract(member, path="", set_attrs=True, *, numeric_owner=False) 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, the uid and gid numbers from the tarfile are used to set the owner/group for th

tarfile.TarFile.addfile()

TarFile.addfile(tarinfo, fileobj=None) Add the TarInfo object tarinfo to the archive. If fileobj is given, it should be a binary file, and tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects directly, or by using gettarinfo().

tarfile.TarFile

class tarfile.TarFile Class for reading and writing tar archives. Do not use this class directly: use tarfile.open() instead. See TarFile Objects.

tarfile.TarError

exception tarfile.TarError Base class for all tarfile exceptions.

tarfile.StreamError

exception tarfile.StreamError Is raised for the limitations that are typical for stream-like TarFile objects.

tarfile.TarFile.close()

TarFile.close() Close the TarFile. In write mode, two finishing zero blocks are appended to the archive.