class calendar.TextCalendar(firstweekday=0)
This class can be used to generate plain text calendars.
TextCalendar
instances have the following methods:
-
formatmonth(theyear, themonth, w=0, l=0)
-
Return a month’s calendar in a multi-line string. If w is provided, it specifies the width of the date columns, which are centered. If l is given, it specifies the number of lines that each week will use. Depends on the first weekday as specified in the constructor or set by the
setfirstweekday()
method.
-
prmonth(theyear, themonth, w=0, l=0)
-
Print a month’s calendar as returned by
formatmonth()
.
-
formatyear(theyear, w=2, l=1, c=6, m=3)
-
Return a m-column calendar for an entire year as a multi-line string. Optional parameters w, l, and c are for date column width, lines per week, and number of spaces between month columns, respectively. Depends on the first weekday as specified in the constructor or set by the
setfirstweekday()
method. The earliest year for which a calendar can be generated is platform-dependent.
-
pryear(theyear, w=2, l=1, c=6, m=3)
-
Print the calendar for an entire year as returned by
formatyear()
.
Please login to continue.