On this page
  1. calendar.leapdays
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

calendar.leapdays

Prev: calendar.isleap | Up: calendar | Next: calendar.LocaleHTMLCalendar
Rel: calendar.calendar, calendar.Calendar, calendar.Day, calendar.firstweekday
Ref: docs.python.org — calendar.leapdays
Tags: #public #python3 #stdlib #calendar


Import

import calendar
from calendar import leapdays

Signature & Overview

calendar.leapdays(y1, y2)

Return number of leap years in range [y1, y2).

Usage

import calendar

# Half-open range [y1, y2): includes y1, excludes y2
assert calendar.leapdays(2020, 2025) == 2   # 2020 and 2024

Gotchas

REPL Inspect

from calendar import leapdays
help(leapdays)

Linked from

Related notes