0 votes
1 view
in Python by (45.2k points)

I read through the zipfile modules docs, but couldn't understand how to unzip a file, only how to zip a file. How do I unzip all the contents of a zip file into the same directory?

1 Answer

0 votes
by (16.8k points)

Simply use this command:

import zipfile

with zipfile.ZipFile(path_to_zip_file, 'r') as zip_ref:

    zip_ref.extractall(directory_to_extract_to)

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jan 2 in Python by ashely (50.5k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...