2 Upvotes
Extracting from a Zip File Using Python
Code demonstrating how use the zipfile Python library to extract the contents of a zip file. In this example, all contents of the zip file are extracted to the current working directory.
import zipfile #Extracts all contents of export.zip zip_file = zipfile.ZipFile('export.zip') zip_file.extractall() zip_file.close() #Extracts only the contents of data folder from export.zip zip_file = zipfile.ZipFile('export.zip') zip_file.extractall('data') zip_file.close()
By GregHe1979 - Last Updated Sept. 8, 2021, 10:15 p.m.
COMMENTS
RELATED SNIPPETS
3
Python Class Example Using __init__ and __repr__
Python
General Python
2
Using a Python Decorator to Print Memory Usage of a DataFrame
Python
General Python
2
2
2
2
2
2
2
1
Find Snippets by Language
Find Snippets by Use