我正在尝试学习 IronPython。我创建了一个像这样的非常简单的类:
class Test:
def testMethod(self):
print "test"
接下来我尝试在 IronPython 控制台中使用它:
>>> import Test
>>> t = Test()
在第二行之后我得到以下错误:
TypeError: Scope is not callable
我做错了什么?
请您参考如下方法:
您需要from filename import Test,其中filename 是保存Test 的文件类的基本名称。
例如:Test类保存在test.py
然后:
from test import Test
t = Test()
将按预期运行。
