Class with methods to open, read, write, close, list zip files.
|
__init__(self,
file,
mode=' r ' ,
compression=0,
allowZip64=False)
Open the ZIP file with mode read "r", write "w"
or append "a". |
source code
|
|
|
_GetContents(self)
Read the directory, making sure we close the file if the format is
bad. |
source code
|
|
|
_RealGetContents(self)
Read in the table of contents for the ZIP file. |
source code
|
|
|
namelist(self)
Return a list of file names in the archive. |
source code
|
|
|
infolist(self)
Return a list of class ZipInfo instances for files in the archive. |
source code
|
|
|
printdir(self)
Print a table of contents for the zip file. |
source code
|
|
|
testzip(self)
Read all the files and check the CRC. |
source code
|
|
|
getinfo(self,
name)
Return the instance of ZipInfo given 'name'. |
source code
|
|
|
setpassword(self,
pwd)
Set default password for encrypted files. |
source code
|
|
|
read(self,
name,
pwd=None)
Return file bytes (as a string) for name. |
source code
|
|
|
open(self,
name,
mode=' r ' ,
pwd=None)
Return file-like object for 'name'. |
source code
|
|
|
extract(self,
member,
path=None,
pwd=None)
Extract a member from the archive to the current working directory,
using its full name. |
source code
|
|
|
extractall(self,
path=None,
members=None,
pwd=None)
Extract all members from the archive to the current working
directory. |
source code
|
|
|
_extract_member(self,
member,
targetpath,
pwd)
Extract the ZipInfo object 'member' to a physical file on the path
targetpath. |
source code
|
|
|
_writecheck(self,
zinfo)
Check for errors before writing a file to the archive. |
source code
|
|
|
write(self,
filename,
arcname=None,
compress_type=None)
Put the bytes from filename into the archive under the name arcname. |
source code
|
|
|
|
|
__del__(self)
Call the "close()" method in case the user forgot. |
source code
|
|
|
close(self)
Close the file, and for mode "w" and "a" write
the ending records. |
source code
|
|