python获取每年的季度,月份
参数:年份,跳跃月数,如果获取每个季度,step=3;半年,step=6返回:起始和结束import datetimeimport calendardef year_by_step(year,step): start = str(year) + "0101" jump = int(step) try: datetime.datetime.strptime(start,"%Y%m%d") except Exception