Python 按月循环
import datetime from dateutil import relativedelta def calculation(stardate, enddate): stardate = datetime.datetime.strptime('2021-10-01', '%Y-%m-%d') enddate = datetime.datetime.strptime('2022-10-01', '%Y-%m-%d') while stardate <= enddate: print(stardate) stardate = stardate + relativedelta.relativedelta(months=1) 互勉
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)