1import zipfile
2with zipfile.ZipFile("file.zip","r") as zip_ref:
3 zip_ref.extractall("targetdir")
1import zipfile
2with zipfile.ZipFile(path_to_zip_file, 'r') as zip_ref:
3 zip_ref.extractall(directory_to_extract_to)
4
1
2import zipfile
3def un_zipFiles(path):
4 files=os.listdir(path)
5 for file in files:
6 if file.endswith('.zip'):
7 filePath=path+'/'+file
8 zip_file = zipfile.ZipFile(filePath)
9 for names in zip_file.namelist():
10 zip_file.extract(names,path)
11 zip_file.close()
1method = 'a'
2from zipfile import ZipFile
3
4with ZipFile(file_directory, 'r') as zip:
5 zip.printdir()
6 zip.extractall(save_directory)
7
8method = 'b'
9unzip -o file.zip