import calendar
print(calendar.isleap(2020))
print(calendar.isleap(2021))
print(calendar.leapdays(2000,2020))#这里是[2000,2020)

output:

True
False
5


import calendar
print(calendar.leapdays(2000,2020))
for i in range(2000,2021):
    if calendar.isleap(i):
        print(i)

output:

5
2000
2004
2008
2012
2016
2020

也就是说calendar.leapday(2000,2020) 是不包含2020的。