Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save giridharmb/b8d9334c88c3082ccd18aef9ee2fbd34 to your computer and use it in GitHub Desktop.

Select an option

Save giridharmb/b8d9334c88c3082ccd18aef9ee2fbd34 to your computer and use it in GitHub Desktop.
complex schedules with simple loops
import datetime
def task():
print("Job Completed!")
while 1:
now = datetime.datetime.now()
# schedule at every wednesday,7:45 pm
if now.weekday == 3 and now.strftime("%H:%m") == "19:45":
task()
# sleep for 6 days
time.sleep(6 * 24 * 60 * 60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment