我当前在我的代码中遇到这个错误
AttributeError: 'Float' object has no attribute 'time'
我没有看到一个与我的完全相同的实例我看到了对dtype=object的一些更改,但我不确定如何实现它,以及为什么需要这样做。这是一个非常直接的函数。在
import time
class lastCycle():
def __init__(self):
self.lastTime = time.time()
self.time = 0.0
def timer(self, time):
if (time.time() - self.lastTime) > self.time:
self.lastTime = time.time()
return True
else:
return False
statusUpdate = lastCycle().timer(1.0)
此处不要使用模块名
time
作为关键字:我想这就是你想要的解决方案:
^{pr2}$类lastCycle(): definit(自身): 自我上次时间= 时间。时间() 自我时间=0.0
^{pr2}$相关问题 更多 >
编程相关推荐