1from datetime import timedelta, date
2
3def daterange(start_date, end_date):
4 for n in range(int ((end_date - start_date).days)):
5 yield start_date + timedelta(n)
6
7start_date = date(2013, 1, 1)
8end_date = date(2015, 6, 2)
9for single_date in daterange(start_date, end_date):
10 print(single_date.strftime("%Y-%m-%d"))
1import datetime
2
3# The size of each step in days
4day_delta = datetime.timedelta(days=1)
5
6start_date = datetime.date.today()
7end_date = start_date + 7*day_delta
8
9for i in range((end_date - start_date).days):
10 print(start_date + i*day_delta)
11
12016-07-21
22016-07-22
32016-07-23
42016-07-24
52016-07-25
62016-07-26
72016-07-27
8