import time as t
class Mytimer():
# 开始计时器
def start(self):
self.start = t.localtime()
print('开始计时…')
# 停止计时器
def stop(self):
self.stop = t.localtime()
self._calc()
print('计时结束!')
# 内部方法,计时运行时间
def _clac(self):
self.lasted = []
self.prompt = '总共运行了'
for index in range(6):
self.lasted.append(self.stop(index) - self.start(index))
self.prompt += str(self.lasted(index))
print(self.prompt)