I am trying to create an array with the following, see this example for my objective.
Currently I have this code which calculates the amount of days in each month between two dates:
a = datetime(2019,11,1)
b = datetime(2023,12,31)
days = [calendar.monthrange(dt_i.year, dt_i.month)[1] for dt_i in rrule.rrule(rrule.MONTHLY, dtstart=a, until=b)]
OUTPUT
[30, 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
OBJECTIVE:
What I am trying to accomplish is something similar but for years
a = datetime(2019,11,1)
b = datetime(2023,12,31)
##Unsure of code going here##
OUTPUT
[60, 366, 365, 365, 365]
With the goal of finding the remaining days in current year, then the days in the out years
Any help appreciated, thanks!