Unzipping Files
suggest changeTo extract or uncompress a tarball, ZIP, or gzip file, Python’s tarfile, zipfile, and gzip modules are provided respectively. Python’s tarfile module provides TarFile.extractall(path=".", members=None) for extracting from a tarball. A .tar.gz file has to be opened with tarfile.open(name, 'r:gz'), not with the TarFile constructor. Python’s zipfile module provides the ZipFile.extractall([path[, members[, pwd]]]) function for extracting or unzipping ZIP compressed files. Finally, Python’s gzip module provides the GzipFile class for decompressing.
Using Python ZipFile.extractall to decompress a ZIP file
Using Python TarFile.extractall to decompress a tarball
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents