I would like to write a simple script to iterate through all the files in a folder and unzip those that are zipped (.zip) to that same folder. For this project, I have a folder
You need to construct a ZipFile
object with the filename, and then extract it:
zipfile.ZipFile.extract(item)
is wrong.
zipfile.ZipFile(item).extractall()
will extract all files from the zip file with the name contained in item
.
I think you should more closely read the documentation to zipfile
:) but you're on the right track!