import datetime
import calendar
# 获取第一天和最后一天
def getFirstAndLastDay(year,month):
# 获取当前月的第一天的星期和当月总天数
weekDay,monthCountDay = calendar.monthrange(year,month)
# 获取当前月份第一天
firstDay = datetime.date(year,month,day=1)
# 获取当前月份最后一天
lastDay = datetime.date(year,month,day=monthCountDay)
# 返回第一天和最后一天
return firstDay,lastDay
# 获取当前年份
year = datetime.date.today().year
# 获取当前月份
month = datetime.date.today().month
lastday = getLastDay(year, month)
print(lastday)