python zipfile 文件壓縮和文件

文件壓縮spa

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

文件解壓縮code

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

 

blog

相關文章
相關標籤/搜索