Using Other Libraries to Manage ZIP Files
Using Other Libraries to Manage ZIP Files. There are a few other tools in the Python standard library that you can use to archive, compress, and decompress your files at a lower level. Python’s
zipfile uses some of these internally, mainly for compression purposes.
In the Python standard library, you’ll also find
tarfile, which supports the TAR archiving format. There’s also a module called
gzip, which provides an interface to compress and decompress data, similar to how the new
GNU Gzip program does it.
A quick and high-level way to create a ZIP file without using
zipfile is to use
shutil. This module allows you to perform several high-level operations on files and collections of files. When it comes to archiving operations, you have
make_archive(), which can create archives such as ZIP or TAR files.
make_archive() function is convenient when you need a quick and high-level way to create your ZIP files in Python. In the next section of the course, you’ll take a look back at what you’ve covered.
Become a Member to join the conversation.