Last active
February 8, 2022 11:33
-
-
Save pratik-choudhari/cdaea482b5abcf730d7fa0078cd4a3cb 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