使用模块

apscheduler

代码

import time
from apscheduler.schedulers.blocking import BlockingScheduler

def func(a, b):  # 定时执行的函数
    print(a, b)

if __name__ == '__main__':
    sched = BlockingScheduler()
    sched.add_job(func,  # 定时执行的函数
                  'cron', 
                  hour=7, minute=0, second=0,  # 每天执行的时分秒
                  coalesce=True, 
                  args=[a, b]  # 函数参数
                 )
    sched.start()  # 启动任务

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2021-10-17
  • 2021-12-02
  • 2022-03-03
  • 2022-01-20
猜你喜欢
  • 2021-11-05
  • 2021-07-05
  • 2021-10-04
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案