from datetime import datetime
firstDate = '16022020'
secondDate = '01012020'
f_date = datetime.strptime(firstDate,'%d%m%Y').date()
s_date = datetime.strptime(secondDate,'%d%m%Y').date()
print((f_date-s_date).days)
Выведет: 46
from datetime import datetime,timedelta,date
firstDate = '16022020'
secondDate = '01012020'
f_date = datetime.strptime(firstDate,'%d%m%Y').date()
s_date = datetime.strptime(secondDate,'%d%m%Y').date()
delta = timedelta(days=1)
while s_date <= f_date:
print (s_date.strftime("%d.%m.%Y"))
s_date += delta
Вывод:
01.01.2020
02.01.2020
03.01.2020
04.01.2020
...
12.02.2020
13.02.2020
14.02.2020
15.02.2020
16.02.2020