I have the following code to do this, but how can I do it better? Right now I think it's better than nested loops, but it starts to get Perl-one-linerish when you have a generator in a list comprehension.
day_count = (end_date - start_date).days + 1
for single_date in [d for d in (start_date + timedelta(n) for n in range(day_count)) if d <= end_date]:
print strftime("%Y-%m-%d", single_date.timetuple())
- I'm not actually using this to print. That's just for demo purposes.
end_date variables are
datetime.date objects because I don't need the timestamps. (They're going to be used to generate a report).
For a start date of
2009-05-30 and the end date of