zoukankan      html  css  js  c++  java
  • python 执行时报错AttributeError: 'dict' object has no attribute 'has_key'

    问题:

    python 执行时报错

    sortedResult = self.sortResult(result.result)
    File "D:Python39libHTMLTestRunner.py", line 642, in sortResult
    if not rmap.has_key(cls):
    AttributeError: 'dict' object has no attribute 'has_key'
    [Finished in 0.2s with exit code 1]

    解决方案:

    查阅资料发现,Python3以后删除了has_key()方法

    打开HTMLTestRunner.py该文件第642行,将 if not rmap.has_key(cls):改为 if not cls in rmap: 保存

    再次运行脚本时,成功。

  • 相关阅读:
    day66
    1
    day65
    BeautifulSoup
    day60
    day59
    day49
    day48
    [S5PV210] PWM
    [S5PV210] Clock
  • 原文地址:https://www.cnblogs.com/bzdmz/p/14494910.html
Copyright © 2011-2022 走看看