python TypeError: 'module' object is not callable
2017-09-07 19:20
846 查看
写入如下代码:
查了下原因是:文件名是random.py。当文件名file name 与模块名 module 相同时会出现如下错误:
另外:Python导入模块的方法有两种
1、import module
2、 from module import
区别是前者所有导入的东西使用时需加上模块名的限定,即module.function,而后者不要,后者直接function.function
import random print(random.random())
查了下原因是:文件名是random.py。当文件名file name 与模块名 module 相同时会出现如下错误:
另外:Python导入模块的方法有两种
1、import module
2、 from module import
区别是前者所有导入的东西使用时需加上模块名的限定,即module.function,而后者不要,后者直接function.function
相关文章推荐
- Python包导入(TypeError: 'module' object is not callable),及一定要记住Python成员函数第一个参数值是self。
- python import 包问题:TypeError: 'module' object is not callable
- python错误:TypeError: 'module' object is not callable
- python 2.7 : 引用模块时出现TypeError:'module' object is not callable
- python错误:TypeError: 'module' object is not callable
- python+selenium自动化测试~打开浏览器报TypeError: 'module' object is not callable
- Python TypeError: 'module' object is not callable
- python错误: TypeError:'dict' object is not callable
- python错误:TypeError: 'str' object is not callable
- Python学习笔记 --- TypeError: 'unicode' object is not callable
- Python:TypeError: 'int' object is not callable
- python的exit退出时,提示TypeError: 'str' object is not callable
- Python:TypeError: 'int' object is not callable
- Anaconda下import caffe出现错误TypeError: 'module' object is not callable
- python class中遇到的TypeError: 'module' object is not callable
- TypeError: 'module' object is not callable
- Python: TypeError: 'int' object is not callable
- TypeError: 'module' object is not callable
- 【Python 笔记】命名域之 TypeError 'DataFrame' object is not callable
- Python: TypeError: 'dict' object is not callable