apscheduler.triggers.date
这是scheduling a job的最简单方法。它计划在指定时间执行一次的作业。它是Apscheduler等于Unix“在”命令。
from datetime import date
from apscheduler.schedulers.blocking import BlockingScheduler
sched = BlockingScheduler()
def my_job(text):
print(text)
# The job will be executed on November 6th, 2009
sched.add_job(my_job, 'date', run_date=date(2009, 11, 6), args=['text'])
sched.start()
您可以在运行作业时指定确切的时间:
# The job will be executed on November 6th, 2009 at 16:30:05
sched