## using datetime.date
from datetime import datetime, date, timedelta
date_begin = date(2009, 6, 1)
date_end = datetime.now().date()
while date_begin <= date_end:
print date_begin
date_begin += timedelta(days=1)
## using datetime.datetime
from datetime import datetime, timedelta
date_begin = datetime(2009, 6, 1)
date_end = datetime.now()
while date_begin.date() <= date_end.date():
print date_begin.date()
date_begin += timedelta(days=1)
|