file and directory handling getinfo(namereturns information about the archive member name as zipinfo instance (described shortlyz infolist(returns list of zipinfo objects for all the members of the archive namelist(returns list of the archive member names open(name [mode [pwd]]opens an archive member named name and returns file-like object for reading the contents name can either be string or zipinfo instance describing one of the archive members mode is the file mode and must be one of the read-only file modes such as ' ''ru'or 'upwd is the password to use for encrypted archive members the file object that is returned supports the read()readline()and readlines(methods as well as iteration with the for statement printdir(prints the archive directory to sys stdout read(name [,pwd]reads archive contents for member name and returns the data as string name is either string or zipinfo instance describing the archive member pwd is the password to use for encrypted archive members setpassword(pwdsets the default password used to extract encrypted files from the archive testzip(reads all the files in the archive and verifies their crc checksums returns the name of the first corrupted file or none if all files are intact write(filename[arcname[compress_type]]writes filename to the archive with the archive name arcname compress_type is the compression parameter and is either zip_stored or zip_deflated by defaultthe compression parameter given to the zipfile(or pyzipfile(function is used the archive must be opened in 'wor 'amode for writes to work writepy(pathnamethis methodavailable only with pyzipfile instancesis used to write python source files (py filesto zip archive and can be used to easily package python applications for distribution if pathname is fileit must end with py in this caseone of the corresponding pyopycor py files will be added (in that orderif pathname is directory and the directory is not python package directoryall the corresponding pyopycor py files are added at the top level if the directory is packagethe files are added under the package name as file path if any subdirectories are also package directoriesthey are added recursively lib fl ff