from zipfile import ZipFile
# Create a ZipFile Object and load sample.zip in it
with ZipFile('sampleDir.zip', 'r') as zipObj:
# Extract all the contents of zip file in current directory
zipObj.extractall()
I want to use a variable instead of sampleDir.zip so that when i place the above code inside for loop that will change the file name each time.
from zipfile import ZipFile
# Create a ZipFile Object and load sample.zip in it
var = 'sampleDir.zip'
with ZipFile(var, 'r') as zipObj:
# Extract all the contents of zip file in current directory
zipObj.extractall()