求各位大神看看我是不是没有装对应的包
import time as tclass MyTimer():
def start(self):
self.start = t.localtime()
print("计时开始")
def stop(self):
self.stop = t.localtime()
print("计时结束")
self._calc
def _calc(self):
self.leasted = []
for index in range(6):
self.leasted.append(self.stop - self.start)
self.info = "总共运行了" + str(self.leasted)
print(self.info)
报错
>>> t = MyTimer()
>>> t.start
<bound method MyTimer.start of <__main__.MyTimer object at 0x000001EDCBADB4A8>>
>>> t.start()
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
t.start()
File "C:\Users\945\Desktop\MyTimer.py", line 5, in start
self.start = t.localtime()
AttributeError: 'MyTimer' object has no attribute 'localtime'
>>>
请问是不是我没有安装对应的包,我这个python下过来确实好久了没动了。 你的模块叫做t,实例化对象也叫t,被覆盖了 冬雪雪冬 发表于 2019-5-17 17:07
你的模块叫做t,实例化对象也叫t,被覆盖了
{:5_104:}哈哈哈好的我知道了,我下次注意
页:
[1]