【问题标题】:Getting error while using json and simple json in .py file在 .py 文件中使用 json 和简单 json 时出错
【发布时间】:2022-01-06 10:51:25
【问题描述】:

当我使用import json 得到错误ImportError: cannot import name 'JSONDecodeError' from 'json' (unknown location)

经过一些研究,我改变了

try:
    import simplejson as json
except ValueError:
    import json

现在新的错误是AttributeError: module 'json' has no attribute 'dumps' 谁能帮我理解这里发生了什么?我正在使用 Python 3.9V

【问题讨论】:

    标签: json python-3.x import attributeerror simplejson


    【解决方案1】:

    我刚刚从我的 pip 列表中卸载了 Json 扩展包,它没有任何提到的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-15
      • 2023-03-03
      • 1970-01-01
      • 2020-10-06
      • 2021-01-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多