|file[, mode[, compression[, allowZip64]]])|
'r'to read an existing file,
'w'to truncate and write a new file, or
'a'to append to an existing file. For mode is
'a'and file refers to an existing ZIP file, then additional files are added to it. If file does not refer to a ZIP file, then a new ZIP archive is appended to the file. This is meant for adding a ZIP archive to another file, such as python.exe. Using
cat myzip.zip >> python.exe
also works, and at least WinZip can read such files.
compression is the ZIP compression method to use when writing
the archive, and should be ZIP_STORED or
ZIP_DEFLATED; unrecognized values will cause
RuntimeError to be raised. If ZIP_DEFLATED
is specified but the zlib module is not available,
RuntimeError is also raised. The default is
If allowZip64 is
True zipfile will create ZIP files that use
the ZIP64 extensions when the zipfile is larger than 2 GB. If it is
false (the default) zipfile will raise an exception when the
ZIP file would require ZIP64 extensions. ZIP64 extensions are disabled by
default because the default zip and unzip commands on
Unix (the InfoZIP utilities) don't support these extensions.
|filename[, arcname[, compress_type]])|
Note: There is no official file name encoding for ZIP files. If you have unicode file names, please convert them to byte strings in your desired encoding before passing them to write(). WinZip interprets all file names as encoded in CP437, also known as DOS Latin.
Note: Archive names should be relative to the archive root, that is, they should not start with a path separator.
The following data attribute is also available:
0(the default, no output) to
3(the most output). Debugging information is written to
See About this document... for information on suggesting changes.