Python Language Working with ZIP archives

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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+



Got any Python Language Question?