Python/schedule

From Fundamental Ramen
< Python
Revision as of 10:39, 23 December 2020 by Tacoball (talk | contribs)
Jump to navigation Jump to search

Some tests

# Okay
schedule.every().wednesday.at('02:28').do(job)
# No effect
schedule.every().wednesday.thursday.at('02:28').do(job)
# 02:56:30 works only
schedule.every().wednesday.at('02:56:00').at('02:56:30').do(job)
import datetime
import time
import schedule

def job():
  isotime = datetime.datetime.now().strftime('%H:%M:%S')
  print("{} | I'm working.".format(isotime))

schedule.every(3).seconds.do(job)
while True:
  schedule.run_pending()
  time.sleep(1)
18:37:57 | I'm working.
18:38:00 | I'm working.
18:38:03 | I'm working.
18:38:06 | I'm working.
18:38:09 | I'm working.