How to initialize a table of months.

7stud bbxx789_05ss at
Mon Apr 16 05:33:27 CEST 2007

On Apr 15, 9:30 pm, "7stud" <bbxx789_0... at> wrote:
> On Apr 15, 7:30 pm, "Steven W. Orr" <ste... at> wrote:


import calendar

months = calendar.month_abbr
#returns an array with the 0 element empty
#so the month names line up with the indexes 1-12

d = {}
for i in range(1, 13):
    d[months[i]] = i

print d

More information about the Python-list mailing list