On this page
calendar.prmonth
Prev: calendar.prcal | Up: calendar | Next: calendar.setfirstweekday
Rel: calendar.calendar, calendar.Calendar, calendar.Day, calendar.firstweekday
Ref: docs.python.org — calendar.prmonth
Tags: #public #python3 #stdlib #calendar
Import
import calendar
from calendar import prmonth
Signature & Overview
calendar.prmonth(theyear, themonth, w=0, l=0)
Print a month's calendar.
Usage
import calendar
import contextlib
import io
buf = io.StringIO()
with contextlib.redirect_stdout(buf):
calendar.prmonth(2026, 12)
assert "December 2026" in buf.getvalue()
Gotchas
- Prints directly to
sys.stdout: Usecalendar.month(y, m)to return a string.
REPL Inspect
from calendar import prmonth
help(prmonth)
Linked from
Related notes
- tuts/python3/stdlib_module/calendar/prcal Linked here; links to this page; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/setfirstweekday Linked here; links to this page; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/calendar Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/Calendar_class Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/Day Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/firstweekday Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/calendar/HTMLCalendar shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/IllegalMonthError shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/IllegalWeekdayError shared tags: #calendar, #stdlib