import calendar year = 2015 month = 2 print(calendar.monthrange(year, month)[1])