Python 属性异常AttributeError: module 'json' has no attribute 'dumps'

简介: 错误信息:E:\python\data>python json.pyTraceback (most recent call last): File "json.

错误信息:

E:\python\data>python json.py
Traceback (most recent call last):
  File "json.py", line 3, in <module>
    import json
  File "E:\python\data\json.py", line 11, in <module>
    json_str = json.dumps(data)
AttributeError: module 'json' has no attribute 'dumps'
img_93750b2ed0a86cf0a64044a94e4b6bc1.png
异常.png

错误原因:

自己创建的Python文件名与系统的文件名重复.

解决方法:

修改自己创建的Python文件名称.

目录
相关文章
|
9月前
|
Python
python Module使用
【10月更文挑战第14天】 python Module使用
206 35
|
9月前
|
Linux Python
【Azure Function】Python Function部署到Azure后报错No module named '_cffi_backend'
ERROR: Error: No module named '_cffi_backend', Cannot find module. Please check the requirements.txt file for the missing module.
183 2
|
11月前
|
数据处理 Python
【Python】解决tqdm ‘module‘ object is not callable
在使用tqdm库时遇到的“'module' object is not callable”错误,并给出了正确的导入方式以及一些使用tqdm的常见示例。
311 1
|
11月前
|
API C++ Python
【Azure 应用服务】Python fastapi Function在Azure中遇见AttributeError异常(AttributeError: 'AsgiMiddleware' object has no attribute 'handle_async')
【Azure 应用服务】Python fastapi Function在Azure中遇见AttributeError异常(AttributeError: 'AsgiMiddleware' object has no attribute 'handle_async')
|
11月前
|
关系型数据库 MySQL Linux
【Azure 应用服务】[App Service For Linux(Function) ] Python ModuleNotFoundError: No module named 'MySQLdb'
【Azure 应用服务】[App Service For Linux(Function) ] Python ModuleNotFoundError: No module named 'MySQLdb'
|
XML 数据格式 Python
Python的`import`用于加载模块,基础形式是`import module`,全量导入
【6月更文挑战第23天】Python的`import`用于加载模块,基础形式是`import module`,全量导入;`from module import name`选择性导入部分,减少命名空间污染;`from module import *`导入所有(不推荐),易引发冲突。别名导入如`from math import sqrt as square_root`可避免冲突。包导入用`.`,如`import xml.etree.ElementTree as ET`。
132 8
|
网络安全 Python
解决Python找不到ssl模块问题 No module named _ssl
解决Python找不到ssl模块问题 No module named _ssl
|
Python
[oeasy]python0024_ 输出时间_time_模块_module_函数_function
[oeasy]python0024_ 输出时间_time_模块_module_函数_function
127 0
[oeasy]python0024_ 输出时间_time_模块_module_函数_function
|
4月前
|
机器学习/深度学习 存储 设计模式
Python 高级编程与实战:深入理解性能优化与调试技巧
本文深入探讨了Python的性能优化与调试技巧,涵盖profiling、caching、Cython等优化工具,以及pdb、logging、assert等调试方法。通过实战项目,如优化斐波那契数列计算和调试Web应用,帮助读者掌握这些技术,提升编程效率。附有进一步学习资源,助力读者深入学习。

推荐镜像

更多