2017-09-23 202 views
2

目前,我有splited到3档test.zip,test.z01一个大的zip文件,test.zip02解压Z01,Z02,压缩在Python文件

我用zip文件库在Python中提取这些文件,但遇到

error: "BadZipFile: Bad magic number for file header" 

with zipfile.ZipFile("test.zip","r") as file: 
    file.extractall(folder_path) 

任何人都知道如何提取这些文件与Python。在python 7zip的/的WinRAR

+0

标准'zipfile'模块不处理多部分档案。你在使用哪种操作系统?您可能能够“掏空”执行外部程序来执行提取。 – mhawke

+0

我目前正在使用Windows 10 –

回答

1

调用命令行interfare应该解决这个问题

import subprocess 
unzip_command = '"C:\\Program Files\\7-Zip\\7z.exe"' + ' e ' + '"' + folder_path + '"' 
subprocess.run(unzip_command, shell = True, cwd = folder_path) 

上述代码将提取FOLDER_PATH夹中的所有文件和文件存储在本