Possible duplicate:
How to iterate over a period of time after days, hours, weeks and months in Python?
I have two objects datetime.date. I would like to sort out all the months between them. (The ability to repeat for an arbitrary unit of time would be even better.) I'm not sure what the best way to do this.
Ideally, I'm looking for something like:
for month in (end - start).months:
For example, if endand startare any dates in April and February, respectively, the result will be February, March, April.
source
share