>>> from calendar import monthrange >>> monthrange(2012, 2) (2, 29) # First number is the weekday of the first day of the month, # the second number is the number of days in said month