压缩
f=zipfile.ZipFile(file, mode=”r”, compression=ZIP_STORED, allowZip64=False)
创建一个zip文件对象,压缩是需要把mode...(‘原文件名’,‘压缩后的文件名’) #第一个是必填,第二个选填
下面放个小demo
import zipfile
import os
def zipDir(dirpath,outFullName,name...:param dirpath: 目标文件夹路径
:param outFullName: 压缩文件保存路径+xxxx.zip
:return: 无
"""
zip = zipfile.ZipFile...(outFullName,"a",zipfile.ZIP_DEFLATED)
for path,dirnames,filenames in os.walk(dirpath):
#...import zipfile,os
with zipfile.ZipFile('aa.zip','w') as target:
for i in os.walk('aa'):