tr_date = time.strftime("%Y%m%d", time.localtime()) print("tr_date======",tr_date) today = datetime.date.today() print("today======",today) # 开始日期 start_date = today - datetime.timedelta(days=today.weekday()) print('datetime.timedelta(days=today.weekday())====',datetime.timedelta(days=today.weekday())) print("start_date111111111111111111======",start_date) start_date = start_date.strftime("%Y%m%d") print("start_date======",start_date) # 结束日期 end_date = today + datetime.timedelta(days=today.weekday()) print("end_date11111111111111111111======",end_date) end_date = end_date.strftime("%Y%m%d") print("end_date======",end_date)