zipfile.ZipInfo

class zipfile.ZipInfo(filename='NoName', date_time=(1980, 1, 1, 0, 0, 0)) 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 modifi

zipfile.ZipFile.writestr()

ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) Write the string data to the archive; zinfo_or_arcname is either the file name it will be given in the archive, or a ZipInfo instance. If it’s an instance, at least the filename, date, and time must be given. If it’s a name, the date and time is set to the current date and time. The archive must be opened with mode 'w', 'x' or 'a' – calling writestr() on a ZipFile created with mode 'r' will raise a RuntimeError. Calling writestr() on

zipfile.ZipFile.write()

ZipFile.write(filename, arcname=None, compress_type=None) 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', 'x' or 'a' – calling write() on a ZipFile created with mode 'r' will raise a Runt

zipfile.ZipFile.testzip()

ZipFile.testzip() Read all the files in the archive and check their CRC’s and file headers. Return the name of the first bad file, or else return None. Calling testzip() on a closed ZipFile will raise a RuntimeError.

zipfile.ZipFile.setpassword()

ZipFile.setpassword(pwd) Set pwd as default password to extract encrypted files.

zipfile.ZipFile.read()

ZipFile.read(name, pwd=None) Return the bytes of the file name in the archive. name is the name of the file in the archive, or a ZipInfo object. The archive must be open for read or append. pwd is the password used for encrypted files and, if specified, it will override the default password set with setpassword(). Calling read() on a closed ZipFile will raise a RuntimeError. Calling read() on a ZipFile that uses a compression method other than ZIP_STORED, ZIP_DEFLATED, ZIP_BZIP2 or ZIP_LZMA

zipfile.ZipFile.printdir()

ZipFile.printdir() Print a table of contents for the archive to sys.stdout.

zipfile.ZipFile.open()

ZipFile.open(name, mode='r', pwd=None) Extract a member from the archive as a file-like object (ZipExtFile). name is the name of the file in the archive, or a ZipInfo object. The mode parameter, if included, must be one of the following: 'r' (the default), 'U', or 'rU'. Choosing 'U' or 'rU' will enable universal newlines support in the read-only object. pwd is the password used for encrypted files. Calling open() on a closed ZipFile will raise a RuntimeError. open() is also a context manager

zipfile.ZipFile.namelist()

ZipFile.namelist() Return a list of archive members by name.

zipfile.ZipFile.infolist()

ZipFile.infolist() Return a list containing a ZipInfo object for each member of the archive. The objects are in the same order as their entries in the actual ZIP file on disk if an existing archive was opened.