from datetime import date, timedelta
sdate = date(2008, 8, 15) # start date
edate = date(2008, 9, 15) # end date
delta = edate - sdate # as timedelta
for i in range(delta.days + 1):
day = sdate + timedelta(days=i)
print(day)
from datetime import date, timedelta
sdate = date(2008, 8, 15) # start date
edate = date(2008, 9, 15) # end date
delta = edate - sdate # as timedelta
for i in range(delta.days + 1):
day = sdate + timedelta(days=i)
print(day)
本文标题:python获取两个日期之间的所有日期
本文链接:https://www.haomeiwen.com/subject/smuhsltx.html
网友评论