12.4 zipfile -- Work with ZIP archives

Python 2.5

12.4 zipfile -- Work with ZIP archives

New in version 1.6.

The ZIP file format is a common archive and compression standard. This module provides tools to create, read, write, append, and list a ZIP file. Any advanced use of this module will require an understanding of the format, as defined in PKZIP Application Note.

This module does not currently handle ZIP files which have appended comments, or multi-disk ZIP files. It can handle ZIP files that use the ZIP64 extensions (that is ZIP files that are more than 4 GByte in size).

The available attributes of this module are:

The error raised for bad ZIP files.

The error raised when a ZIP file would require ZIP64 functionality but that has not been enabled.

The class for reading and writing ZIP files. See ``ZipFile Objects'' (section 12.4.1) for constructor details.

Class for creating ZIP archives containing Python libraries.

Class used to represent information about a member of an archive. Instances of this class are returned by the getinfo() and infolist() methods of ZipFile objects. Most users of the zipfile module will not need to create these, but only use those created by this module. filename should be the full name of the archive member, and date_time should be a tuple containing six fields which describe the time of the last modification to the file; the fields are described in section 12.4.3, ``ZipInfo Objects.''

Returns True if filename is a valid ZIP file based on its magic number, otherwise returns False. This module does not currently handle ZIP files which have appended comments.

The numeric constant for an uncompressed archive member.

The numeric constant for the usual ZIP compression method. This requires the zlib module. No other compression methods are currently supported.

See Also:

Documentation on the ZIP file format by Phil Katz, the creator of the format and algorithms used.

Information about the Info-ZIP project's ZIP archive programs and development libraries.


See About this document... for information on suggesting changes.