Best way to get months name in Python language

Best way to get months name in Python language

Python calendar in-built library is best to use to get month name. By using this you don’t need to do dirty way to create dictionary of month.

import calendar
for i in range(1,13):
   print calendar.month_name[i]

Output

>>> 
January
February
March
April
May
June
July
August
September
October
November
December   
Share

Recommended Posts

Leave a Reply

Your email address will not be published. Required fields are marked *