Date validation

Fredrik Lundh fredrik at pythonware.com
Fri Apr 25 03:48:56 EDT 2003


James Gregory wrote:

> I mean I *could* write this myself, but I had to ask the computer how
> many days in April - someone with a better grasp of the date must have
> written this stuff before :)

don't you have any knuckles on your left hand?

if you want your program to check how many days there are in
a given month, use the calendar module:

>>> import calendar
>>> firstday, ndays = calendar.monthrange(2003, 4)
>>> print ndays
30
>>> print calendar.day_abbr[firstday]
'Tue'

</F>








More information about the Python-list mailing list