[Tutor] Calendar question

Kristian Zoerhoff kristian.zoerhoff at gmail.com
Tue Apr 5 18:34:49 CEST 2005


On Apr 5, 2005 11:26 AM, John Carmona <jeannot18 at hotmail.com> wrote:
> But how do you use the prmonth command, if you, for example, want to write
> something asking you:
> 
> to enter a year (this I know)
> to enter a month of that year
> and print just the month

>>> import calendar
>>> year = int(raw_input("Year? "))
>>> month = int(raw_input("Month? "))
>>> calendar.prmonth(year, month)

This assumes all input as integers; if you want months entered by
name, you'll have to write a conversion routine (hint: use a dict).

-- 
Kristian

kristian.zoerhoff(AT)gmail.com
zoerhoff(AT)freeshell.org


More information about the Tutor mailing list