python zipfile 文件压缩和文件

文件压缩

zipfile_obj = zipfile.ZipFile(zipfile_objpath, 'a', zipfile.ZIP_DEFLATED)
for dirpath, dirnames, filenames in os.walk(customer_file_path):
for file in filenames:
zipfile_obj.write(file, zipfilepath)
zipfile_obj.close

文件解压缩

f = zipfile.ZipFile(zipfilepath, 'r')
for file_obj in f.namelist():
unzipfile = f.extract(file_obj, unzipfilepath)

上一篇:Vagrant入门


下一篇:破解win10系统密码