Created
January 9, 2016 11:54
-
-
Save judy2k/7f7ed5590aedf0615720 to your computer and use it in GitHub Desktop.
Find the next weekday after the given date.
This file contains 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
from datetime import date, timedelta | |
def next_weekday(d): | |
wd = d.weekday() | |
return d + timedelta(days=1 if wd < 4 else 7 - wd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment