Working with ZIP archives

Download python eBook

Syntax

  • import zipfile
  • class zipfile.ZipFile(file, mode='r', compression=ZIP_STORED, allowZip64=True)

Remarks

If you try to open a file that is not a ZIP file, the exception zipfile.BadZipFile is raised.

In Python 2.7, this was spelled zipfile.BadZipfile, and this old name is retained alongside the new one in Python 3.2+

Related Examples

Stats

67 Contributors: 4
Wednesday, September 14, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook