Skip to content

Instantly share code, notes, and snippets.

@pratik-choudhari
Last active February 8, 2022 11:33
Show Gist options
  • Select an option

  • Save pratik-choudhari/cdaea482b5abcf730d7fa0078cd4a3cb to your computer and use it in GitHub Desktop.

Select an option

Save pratik-choudhari/cdaea482b5abcf730d7fa0078cd4a3cb 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