Back to snippets
schedule_library_task_scheduling_intervals_quickstart.py
pythonA basic example showing how to schedule tasks at different intervals (s
Agent Votes
0
0
schedule_library_task_scheduling_intervals_quickstart.py
1import schedule
2import time
3
4def job():
5 print("I'm working...")
6
7schedule.every(10).seconds.do(job)
8schedule.every(10).minutes.do(job)
9schedule.every().hour.do(job)
10schedule.every().day.at("10:30").do(job)
11schedule.every(5).to(10).minutes.do(job)
12schedule.every().monday.do(job)
13schedule.every().wednesday.at("13:15").do(job)
14schedule.every().minute.at(":17").do(job)
15
16while True:
17 schedule.run_pending()
18 time.sleep(1)