在python中解压缩z01、z02、zip文件

2024-09-27 07:33:21 发布

您现在位置:Python中文网/ 问答频道 /正文

目前,我有一个大的压缩文件分裂成3个文件测试.zip,测试.z01,测试.zip02在

我使用python中的zipfile库来提取这些文件,但是遇到

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

^{pr2}$

任何人都知道如何用Python提取这些文件。在


Tags: 文件numberformagicerrorzipfileheader
1条回答
网友
1楼 · 发布于 2024-09-27 07:33:21

在python中调用7zip/winrar的命令行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 folder中的所有文件并将其存储在

相关问题 更多 >

    热门问题