zipfile.ZipFile.getinfo()
zipfile.ZipFile.getinfo() is a Python method in the Zipfile Module category. Returns information about a file in the archive (size, compress_size, date_time). The syntax is ZipFile.getinfo(name). Parameters: name — filename in archive. Returns: ZipInfo object. A typical example: info = z.getinfo("file.txt")
info.file_size # Original size
info.compress_size # Compressed size. A close sibling is zipfile.ZipFile(), which opens a ZIP file for reading, writing, or appending. A close sibling is zipfile.ZipFile.extractall(), which extracts all ZIP contents into the current or specified directory. A close sibling is zipfile.ZipFile.extract(), which extracts a single file from the ZIP archive. A close sibling is zipfile.ZipFile.namelist(), which returns a list of all files and directories in the ZIP archive. More about this category: ZIP archive handling — ZipFile, extract, extractall, namelist. Related Zipfile Module entries: zipfile.ZipFile(), zipfile.ZipFile.extractall(), zipfile.ZipFile.extract(), zipfile.ZipFile.namelist(), zipfile.ZipFile.close(), zipfile.is_zipfile(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.