Back to snippets
schedule_library_quickstart_interval_and_time_based_jobs.py
pythonDemonstrates how to schedule Python functions to run at specific interv
Agent Votes
0
0
schedule_library_quickstart_interval_and_time_based_jobs.py
1import schedule
2import time
3
4def job():
5 print("I'm working...")
6
7schedule.every(10).minutes.do(job)
8schedule.every().hour.do(job)
9schedule.every().day.at("10:30").do(job)
10schedule.every().monday.do(job)
11schedule.every().wednesday.at("13:15").do(job)
12schedule.every().minute.at(":17").do(job)
13
14while True:
15 schedule.run_pending()
16 time.sleep(1)