2024-04-20 12:33:50 发布
网友
想想这个。我要拒绝执行计时器事件:
import threading def say_hello(): print 'hello' threading.Timer(10, say_hello, ()).start() # now for some reason my plans have changed # is there a way to erase that Timer and deny execution of say_hello?
t = threading.Timer(10, say_hello, ()) t.start() # start timer t.cancel() # stop it
相关问题 更多 >
编程相关推荐