apscheduler定时器

每天定时任务:

import time
from apscheduler.schedulers.background import BackgroundScheduler


def foo():
    print(1234)


sched = BackgroundScheduler()
sched.start()
sched.add_job(foo, 'cron', day_of_week='0-6', hour=1, minute=42, second=10, id='1')
sched.add_job(foo, 'cron', day_of_week='0-6', hour=1, minute=42, second=12, id='2')
sched.add_job(foo, 'cron', day_of_week='0-6', hour=1, minute=42, second=14, id='3')
sched.add_job(foo, 'cron', day_of_week='0-6', hour=1, minute=42, second=16, id='4')
time.sleep(80000)

 https://www.cnblogs.com/zhaoyingjie/p/9664081.html

 

转载于:https://www.cnblogs.com/zhzhlong/p/10569196.html

你可能感兴趣的:(apscheduler定时器)