GIS often requires the use of large files that will be compressed into a
.zip format for ease of sharing. Python includes a module that you can use to decompress and compress files in this format.
Zip is a common compression and archive format and is implemented in Python through the
zipfile module. The
ZipFile class can be used to create, read, and write
.zip files. To create a new
.zip file, simply provide the filename along with a mode such as
w, which indicates that you want to write data to the file. In the following code example, we are creating a
.zip file called
datafile.zip. The second parameter,
w, indicates that a new file will be created. A new file will be created or an existing file with the same name ...