我用下面的代码类实例化 - 多态性 - 的Python
class FooBar:
def __init__(self):
self.x = 0
self.y = 0
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
我保存上述FooBar.py
当我使用,
import FooBar
p = FooBar()
错误说module object not callable
。是什么原因?
需要用'P = FooBar.FooBar()'或'使用从FooBar导入FooBar'。 – martineau
你在哪里保存FooBar.py? –