python 计算指定日期后的几个工作日日期
SingYi
发布
于
2022-07-13 20:17:08
发布
于
2022-07-13 20:17:08
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