[Tutor] iterate over daterange

captnswing captnswing at gmx.net
Fri Jan 6 23:47:15 CET 2006

I have a startdate and an enddate and I want to iterate over all days  
in between the two

.... there doesn't seem to be a range function for dates?!?

i.e. currently I am going through integers with something like this:

startdate = datetime.date(2006,1,1)
enddate = datetime.date(2006,10,19)

for i in range((enddate-startdate).days + 1):
	currentdate = startdate + datetime.timedelta(days=i)

this seems so 'unpythonic', there surely must be a better way, no?

More information about the Tutor mailing list