w3resource

Python TextCalendar Module: leapdays() method

leapdays() method

The leapdays() method is used to get the number of leap years in a specified range of years.
This function works for ranges spanning a century change.

Syntax:

leapdays(y1, y2)

Parameters:

Name Description Required /
Optional
Type
y1, y2 y1 and y2 are years to get the number of leap years. Required Number

Example of leapdays() method

import calendar
print(calendar.leapdays(2015, 2018))

Output:

1

Previous: isleap()
Next: weekday()

Test your Python skills with w3resource's quiz



Follow us on Facebook and Twitter for latest update.