๐
Work with zip file
When we want work with zip file use below instruction
python
from pathlib import Pathfrom zipfile import ZipFilewith ZipFile("test/zipfile.zip", "w") as zipdata: # create zip filefor path in Path().glob("*.py"):zipdata.write(path)with ZipFile("test/zipfile.zip") as zipdata: # read data of files in zip fileprint(zipdata.namelist())info = zipdata.getinfo("test.py")print(info.file_size)print(info.compress_size)zipdata.extractall("test/extract")
