有没有办法使用Python 3从7z格式中提取文件?

Cha*_*ddy 5 7zip python-3.6

我正在尝试使用 python 从 7z 格式中提取文件。有人能告诉我如何在 python 3.6 上完成它吗?

Dea*_*ack -5

您可以使用以下内容: https: //pypi.org/project/pyunpack/

或者您可以使用以下命令: from zipfile import ZipFile

with ZipFile('your_zip_file.zip') as zipArch: #or a 7z file
    zipArch.extractall("dest_folder", pwd=bytes('the_zip_password','utf-8')) #If it is password protected
Run Code Online (Sandbox Code Playgroud)

  • 解压 7z 导致 BadZipFile 异常 (3认同)