有没有办法拒绝定时事件?

2024-04-20 12:33:50 发布

您现在位置:Python中文网/ 问答频道 /正文

想想这个。我要拒绝执行计时器事件:

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?

Tags: importhelloformydef事件somestart