Use Python’s built-in zipfile module to extract a ZIP archive: open it with ZipFile, then call extractall() for every file or extract() for one selected member. No extra package is needed for basic ZIP extraction.
Extract every file from a ZIP archive
Pass the archive path to ZipFile and the destination folder to extractall(). The context manager closes the archive automatically when extraction finishes.
from zipfile import ZipFile
with ZipFile("archive.zip") as archive:
archive.extractall("output_folder")
Replace archive.zip with your ZIP file’s path and output_folder with the folder where you want its contents placed. If you omit the destination argument, extraction targets the current working directory.
Extract just one file
Use extract() and provide the member’s name as it appears inside the archive. The second argument sets the destination folder.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
from zipfile import ZipFile
with ZipFile("archive.zip") as archive:
archive.extract("reports/summary.csv", "output_folder")
If you do not know the exact member name, list the archive contents first:
from zipfile import ZipFile
with ZipFile("archive.zip") as archive:
print(archive.namelist())
namelist() returns the names of the members. Use one of those names in extract(); infolist() is another option when you need each member’s ZipInfo record. See the Python 3.14.8 zipfile documentation for the API details.
Rank #2
Unzip from the command line instead
For a one-off extraction that does not need to be part of a Python script, use the standard-library command-line interface:
python -m zipfile -e archive.zip output_folder
To list the members, use -l; to test whether the archive is valid, use -t. These options are documented in the Python zipfile reference.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchHandle untrusted ZIP files carefully
Python’s documentation warns: “Never extract archives from untrusted sources without prior inspection.” ZIP member names can contain absolute paths or .. components that attempt to write outside the chosen folder. The extraction methods try to prevent this, but the zipfile.Path interface does not sanitize names; if you use it with untrusted archives, validate paths yourself.
Also consider whether the archive could expand to consume excessive disk space. A decompression bomb can exhaust available storage. Check the archive’s source, member names and expected output size, and make sure you have enough disk space before extracting it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot extraction errors
Extraction can fail for several documented reasons. Check the archive and environment for these common causes:
- Invalid ZIP: The file may be damaged or not be a valid ZIP archive.
- Password issue: An encrypted member may require the correct password.
- Unsupported compression: The archive may use a compression method Python cannot handle, or an optional compression module may be unavailable.
- Filesystem limits: The destination filesystem may restrict a path or filename length, or prevent writing to the destination.
- Insufficient resources: Extraction may require more memory or disk space than is available.
Choose the destination with care: extracting again may overwrite existing files without prompting. The Python documentation for zipfile describes these limitations and security considerations.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




