Jak rozpakować pliki za pomocą Pythona modułu Zipfile
import zipfile
with zipfile.ZipFile("file.zip","r") as zip_ref:
zip_ref.extractall("targetdir")
Muddy Millipede
import zipfile
with zipfile.ZipFile("file.zip","r") as zip_ref:
zip_ref.extractall("targetdir")
import zipfile
with zipfile.ZipFile(path_to_zip_file, 'r') as zip_ref:
zip_ref.extractall(directory_to_extract_to)
# app.py
from zipfile import ZipFile
with ZipFile('Mail3.zip', 'r') as zipObj:
# Extract all the contents of zip file in different directory
zipObj.extractall('temp')
print('File is unzipped in temp folder')
from zipfile import ZipFile
import zipfile
with ZipFile('test.zip') as myzip:
with myzip.open('Roughwork/textfile.text') as myfile:
print(myfile.readlines())Copy Code
from zipfile import ZipFile
import zipfile
myzip = ZipFile('test.zip')
myzip.extract(member='Roughwork/pretify.html')
ZipFile.extractall(path=None, members=None, pwd=None)