Mar-11-2017, 03:38 PM
(This post was last modified: Mar-11-2017, 04:08 PM by ichabod801.)
Hi There,
I am new to python and I am trying to create a recursive function which will return all the dates between 2017,2,28 and 2017,3,10.I have set a base case with the start date and the end date 2017,3,10.I am not too sure where I am going wrong.Your help would be much appreciated.
I am new to python and I am trying to create a recursive function which will return all the dates between 2017,2,28 and 2017,3,10.I have set a base case with the start date and the end date 2017,3,10.I am not too sure where I am going wrong.Your help would be much appreciated.
from datetime import date,timedelta,datetime def daterec(start,end,timedelta): if start == date(2017,2,28): return start return daterec(start + timedelta(days=1) for dat in daterec(date(2017, 2, 28), date(2017, 3, 10), timedelta(days=1)): print(dat)