How to extract zip file in Python

We can use the Python module zipfile for extracting the zip files.

The syntax is as given below.

import zipfile
zip_ref = zipfile.ZipFile(path_to_zip_file, 'r')


path_to_zip_file - Exact path to the zip file
directory_to_extract_to - Folder to which the zip need to exctract


Leave a Reply

Your email address will not be published. Required fields are marked *