文件压缩

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)

 

 

posted on 2017-01-11 17:07  寒夜落雪  阅读(1813)  评论(0编辑  收藏  举报