calendar.TextCalendar

class calendar.TextCalendar(firstweekday=0)[source]

Subclass of Calendar that outputs a calendar as a simple plain text similar to the UNIX program cal.

Methods

__format__ default object formatter
__init__([firstweekday])
__new__((S, ...)
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__sizeof__(() -> int) size of object in memory, in bytes
__subclasshook__ Abstract classes can override this to customize issubclass().
formatday(day, weekday, width) Returns a formatted day.
formatmonth(theyear, themonth[, w, l]) Return a month’s calendar string (multi-line).
formatmonthname(theyear, themonth, width[, ...]) Return a formatted month name.
formatweek(theweek, width) Returns a single week in a string (no newline).
formatweekday(day, width) Returns a formatted week day name.
formatweekheader(width) Return a header for a week.
formatyear(theyear[, w, l, c, m]) Returns a year’s calendar as a multi-line string.
getfirstweekday()
itermonthdates(year, month) Return an iterator for one month.
itermonthdays(year, month) Like itermonthdates(), but will yield day numbers.
itermonthdays2(year, month) Like itermonthdates(), but will yield (day number, weekday number) tuples.
iterweekdays() Return an iterator for one week of weekday numbers starting with the configured first one.
monthdatescalendar(year, month) Return a matrix (list of lists) representing a month’s calendar.
monthdays2calendar(year, month) Return a matrix representing a month’s calendar.
monthdayscalendar(year, month) Return a matrix representing a month’s calendar.
prmonth(theyear, themonth[, w, l]) Print a month’s calendar.
prweek(theweek, width) Print a single week (no newline).
pryear(theyear[, w, l, c, m]) Print a year’s calendar.
setfirstweekday(firstweekday)
yeardatescalendar(year[, width]) Return the data for the specified year ready for formatting.
yeardays2calendar(year[, width]) Return the data for the specified year ready for formatting (similar to yeardatescalendar()).
yeardayscalendar(year[, width]) Return the data for the specified year ready for formatting (similar to yeardatescalendar()).

Attributes

firstweekday