使用python中的calendar,原型如下:
- calendar.monthrange(year, month)
Returns weekday of first day of the month and number of days in month, for the specified year and month.
#import calendar
week_day = calendar.monthrange(2012,11)[0]
days = calendar.monthrange(2012,11)[1]