import time as t
class MyTimer():
#计时开始
def start(self):
self.starttime=t.localtime
print("计时开始")
#计时结束
def stop(self):
self.stoptime=t.localtime
self.__calc()
print("计时结束")
#计算运行时间,内部方法
def __calc(self):
self.lasted=[]
self.prompt="总共运行了"
for index in range(6):
self.lasted.append(self.stoptime[index]-self.starttime[index])
self.prompt+=str(self.lasted[index])
print(self.prompt)
这是个简单的计时器程序,运行时出现如下错误,请大神指导,谢谢。。