Sie müssen das Tarfile-Modul verwenden. Insbesondere verwenden Sie eine Instanz der Klasse TarFile, um auf die Datei zuzugreifen, und greifen dann mit TarFile.getnames () auf die Namen zu.
| getnames(self)
| Return the members of the archive as a list of their names. It has
| the same order as the list returned by getmembers().
Wenn Sie stattdessen den Inhalt lesen möchten , verwenden Sie diese Methode
| extractfile(self, 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, a
| file-like object is returned. If `member' is a link, a file-like
| object is constructed from the link's target. If `member' is none of
| the above, None is returned.
| The file-like object is read-only and provides the following
| methods: read(), readline(), readlines(), seek() and tell()