我试图在每5秒后调用一个方法。但是,它似乎只被调用一次,程序停止执行。 这是我正在尝试的代码:
class MyClass(object):
def getData(self):
print "I am not able to call after every interval"
def main():
m = MyClass()
m.getData()
Timer(2.0, main).start()
答案 0 :(得分:0)
class MyClass(object):
def getData(self):
print "I am not able to call after every interval"
def main():
while "foo" != "bar":
m = MyClass()
Timer(2.0, m.getData()).start()
main()