calendar.TextCalendar()
calendar.TextCalendar() is a Python function in the Calendar Module category. Creates a calendar that generates plain text calendars. The syntax is calendar.TextCalendar(firstweekday=0). Returns: TextCalendar object. A typical example: import calendar
c = calendar.TextCalendar()
print(c.formatmonth(2026, 6)) # June 2026 calendar. A close sibling is calendar.HTMLCalendar(), which creates a calendar that generates HTML 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.HTMLCalendar(), 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.