Last active
August 29, 2015 14:05
-
-
Save jangeador/f3e4691a239ede6921e1 to your computer and use it in GitHub Desktop.
Generate a list of the months of the year in Python
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
''' | |
Generate a sorted list with the months of the year | |
''' | |
import datetime | |
months = [datetime.date(2000, m, 1).strftime('%m - %B') for m in range(1, 13)] | |
print months | |
''' | |
print months | |
['01 - January', '02 - February', '03 - March', '04 - April', '05 - May', '06 - June', '07 - July', '08 - August', '09 - September', '10 - October', '11 - November', '12 - December'] | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment