import datetime
def main(target_date, days):
target_date = datetime.datetime.strptime(target_date, '%Y-%m-%d')
while days + 1:
target_date = target_date + datetime.timedelta(days=1)
days = days - 1 if 1 <= target_date.isoweekday() <= 5 else days
return target_date
# www.lanol.cn
if __name__ == '__main__':
print(f"指定结果:{main('2022-2-21', 2)}")
@松涛哥 提供的问题
评论 (0)