Python Timer定时器:控制函数在规定时间实施
from threading import Timer def hello(): print(hello, world) # 指定10秒后执行hello函数 t = Timer(10.0, hello) t.start() 上面程序使用 Timer 控制 10s 后执行 hello 函数。 需要说明的是,Timer 只能控制函数在指定时间内执行一次,如果要使用 Time
from threading import Timer def hello(): print(hello, world) # 指定10秒后执行hello函数 t = Timer(10.0, hello) t.start() 上面程序使用 Timer 控制 10s 后执行 hello 函数。 需要说明的是,Timer 只能控制函数在指定时间内执行一次,如果要使用 Time