Calendar
The `calendar` module provides calendar-related functions including generating calendars, calculating weekdays, and working with month/year data. The guide walks through Generating Calendars, Weekday Calculations, Locale Calendars. `calendar.TextCalendar().formatmonth(2026, 6)` returns a text calendar for June 2026. `calendar.HTMLCalendar().formatmonth(2026, 6)` generates an HTML calendar table. `calendar.prcal(2026)` prints a full year calendar. Use these for generating date pickers, printable calendars, and schedule views. The TextCalendar output is useful for CLI applications and quick debugging. `calendar.weekday(year, month, day)` returns 0-6 (Monday=0, Sunday=6). `calendar.day_name[calendar.weekday(2026, 6, 6)]` returns 'Saturday'. `calendar.monthrange(year, month)` returns (first_weekday, num_days) for building calendar UIs. `calendar.isleap(year)` checks leap years. `calendar.leapdays(y1, y2)` counts leap days between years. `calendar.LocaleTextCalendar(locale="en_US")` generates localized calendars with translated month/weekday names. Supported locales depend on your system. Fallback to English if locale unavailable. Useful for multi-language applications that need to display dates in the user's language. The guide is organized into 3 sections that build on each other, each pairing a prose explanation with runnable code.