python scheduler code example

Example 1: python schedule

# to install schedule
# RUN "python -m pip install schedule" in CMD

import schedule
import time

def job():
    print("I'm working...")

schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)
schedule.every().monday.do(job)
schedule.every().wednesday.at("13:15").do(job)
schedule.every().minute.at(":17").do(job)

while True:
    schedule.run_pending()
    time.sleep(1)

Example 2: python program to run a youtube video at a schduled time

Scheduling tasks in python