Python 模块导入有两种方法,如果出现这个错误就是因为模块导入问题:
TypeError: ‘module’ object is not callable
class Person : def __init__(self) : self.name = "liuchang" self.id = 123 def say_id(self) : print "%s's id is %d" % (self.name,self.id)
第一种导入方法:
>>> import Person
>>> person = Person.Person()
>>> print person.say_id()
第二种导入方法:
>>> from Person import *
>>> person = Person()
>>> print person.sys_id()