ZipFile.write(filename[, arcname[, compress_type]])
Write the file named filename to the archive, giving it the archive name
arcname (by default, this will be the same as filename, but without a drive
letter and with leading path separators removed). If given, compress_type
overrides the value given for the compression parameter to the constructor for
the new entry. The archive must be open with mode 'w'
or 'a'
-- calling
write on a ZipFile created with mode 'r'
will raise a
RuntimeError. Calling write on a closed ZipFile will raise a
RuntimeError.
NOTE:
There is no official file name encoding for ZIP files. If you have unicode file
names, you must 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.
NOTE:
If arcname
(or filename
, if arcname
is not given) contains a null
byte, the name of the file in the archive will be truncated at the null byte.