0 points

datetime - Iterating through a range of dates in Python - Stack Overflow


dashboard

Fri May 15 2020 06:32:03 GMT+0000 (UTC)

Posted by @salitha.pathi #python

from datetime import date
from dateutil.rrule import rrule, DAILY

a = date(2009, 5, 30)
b = date(2009, 6, 9)

for dt in rrule(DAILY, dtstart=a, until=b):
    print dt.strftime("%Y-%m-%d")
content_copy Copy

https://stackoverflow.com/questions/1060279/iterating-through-a-range-of-dates-in-python