python - ZipFile.extractall 抛出 ZipFile 实例没有属性 'extractall'

标签 python python-zipfile

以下是我的代码:

import zipfile
from zipfile import ZipFile

def extract(zipFilename, dm_extraction_dir) :
   zipTest = ZipFile(zipFilename)
   zipTest.extractall(dm_extraction_dir)

extract("myzip.zip", "C:/Temp") 

当我执行此代码时,抛出 ZipFile 实例没有属性“extractall”,我使用的是 Python 2.5,解释器是 jython,不知道为什么会收到此错误。

最佳答案

来自the docs :

New in version 2.6.

关于python - ZipFile.extractall 抛出 ZipFile 实例没有属性 'extractall',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10064022/

相关文章:

python - 如何将 ssh.exec_command 的输出重定向到 Python paramiko 模块中的文件?

python - 我可以在屏幕上移动pygame游戏窗口吗(pygame)

python - 在 zip 文件中递归列出所有目录,无需在 python 中解压

python - 如何使用 Python zipfile 将文件放入 zip 存档中

python - 无法使用 ZipFile 打开子目录中的文件

python - 如何将 __len__ 添加到数据类型定义中没有 __len__ 的对象?

python - 优化井字棋检查

python - zip 中的损坏数据导致下载后无法解压

python - 我怎样才能避免: "ZipFile instance has no attribute ' __exit_ _'' "when extracting a zip file?

python - WordPress XmlRpc Python 错误