Использование itertools.groupby
для получения количества дней в каждом месяце:
import calendar
from datetime import datetime, timedelta
from itertools import groupby
start = datetime(2020,10,1)
end = datetime(2020,12,15)
for v, g in groupby(((start + timedelta(days=i)).month for i in range(1, (end - start).days + 1))):
l = sum(1 for _ in g)
print('{} {} in {}'.format(l, 'day' if l == 1 else 'days', calendar.month_name[v]))
Печать:
30 days in October
30 days in November
15 days in December