calendar.HTMLCalendar()
calendar.HTMLCalendar() is a Python function in the Calendar Module category. Creates a calendar that generates HTML calendars. The syntax is calendar.HTMLCalendar(firstweekday=0). Returns: HTMLCalendar object. A typical example: c = calendar.HTMLCalendar()
print(c.formatmonth(2026, 6)) # HTML table. A close sibling is calendar.TextCalendar(), which creates a calendar that generates plain text calendars. A close sibling is calendar.isleap(), which returns True if the year is a leap year. A close sibling is calendar.leapdays(), which returns the number of leap years in the range [y1, y2). A close sibling is calendar.weekday(), which returns the day of the week (0=Monday, 6=Sunday). More about this category: Calendar functions — TextCalendar, isleap, monthrange, weekday. For a broader walkthrough, read the Calendar Module guide. Related Calendar Module entries: calendar.TextCalendar(), calendar.isleap(), calendar.leapdays(), calendar.weekday(), calendar.monthrange(), calendar.day_name. This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.