Forked from pratik-choudhari/complex_schedules_simple_loops.py
Created
October 21, 2021 19:10
-
-
Save giridharmb/b8d9334c88c3082ccd18aef9ee2fbd34 to your computer and use it in GitHub Desktop.
complex schedules with simple loops
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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