sched 模块 引用time类实现任务定时执行
1 import time 2 import sched 3 4 def worker(msg): 5 print msg 6 7 s = sched.scheduler(time.time,time.sleep) 8 s.enter(延迟时间,优先级,任务函数,(任务参数,)) 9 s.run()
任务参数书元组类型,必须加参数后边必须加,号
sched 模块 引用time类实现任务定时执行
1 import time 2 import sched 3 4 def worker(msg): 5 print msg 6 7 s = sched.scheduler(time.time,time.sleep) 8 s.enter(延迟时间,优先级,任务函数,(任务参数,)) 9 s.run()
任务参数书元组类型,必须加参数后边必须加,号
转载于:https://www.cnblogs.com/pxfb/p/8350071.html