O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

zipfile

The zipfile module is used to manipulate files encoded in the popular zip format (originally known as PKZIP, although now supported by a wide variety of programs). The following functions are available:


is_zipfile(filename)

Tests filename to see if it’s a valid zip file. Returns True if filename is a zip file; returns False otherwise.


ZipFile(filename [, mode [, compression]])

Opens a zip file, filename, and returns a ZipFile instance. mode is 'r' to read from an existing file, 'w' to truncate the file and write a new file, or 'a' to append to an existing file. For 'a' mode, if filename is an existing zip file, new files are added to it. If filename is not a zip file, the archive is simply appended to the end of the file. compression ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required