我有模块 Test.py 和模块内的类测试。这是代码:
class test:
SIZE = 100;
tot = 0;
def __init__(self, int1, int2):
tot = int1 + int2;
def getTot(self):
return tot;
def printIntegers(self):
for i in range(0, 10):
print(i);
现在,在口译员处,我尝试:
>>> import Test
>>> t = test(1, 2);
我收到以下错误:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
t = test(1, 2);
NameError: name 'test' is not defined
我哪里做错了?