发布时间:2019-07-15 10:45:51编辑:auto阅读(1596)
[seemmo@RegionServer1 duwen]$ python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import Student
s = Student()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callablefrom Student import *
s = Student()
原因:
import module 和 from module import,区别是前者所有导入的东西使用时需加上模块名的限定,而后者不要。
可以试试:
[seemmo@RegionServer1 duwen]$ python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import Student
s = Student()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callables = Student.Student()
上一篇: python 文件内容对比操作
下一篇: python abc模块
47483
45786
36783
34310
28955
25589
24436
19606
19096
17626
5458°
6041°
5557°
5632°
6558°
5370°
5370°
5877°
5850°
7163°