Created
November 30, 2017 15:58
-
-
Save zhjgithub/035794ecf040f1a9d07b4bc1cddf8ab4 to your computer and use it in GitHub Desktop.
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
months = ['January', | |
'February', | |
'March', | |
'April', | |
'May', | |
'June', | |
'July', | |
'August', | |
'September', | |
'October', | |
'November', | |
'December'] | |
month_abrrs = dict((m[:3].lower(), m) for m in months) # List comprehensions generator | |
def valid_month(month): | |
if month: | |
month = month.strip()[:3].lower() | |
if month in month_abrrs: | |
return month_abrrs.get(month) | |
return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment