def getDate(year,month): day=31 while day: try: time.strptime('%s-%s-%d'%(year,month,day),'%Y-%m-%d') return '%s年%s月1日至%s年%s月%s日'%(year,month,year,month,day) except: day-=1