![]() |
VOOZH | about |
Calendar module allows to output calendars like program, and provides additional useful functions related to the calendar. Functions and classes defined in Calendar module use an idealized calendar, the current Gregorian calendar extended indefinitely in both directions. class calendar.HTMLCalendar(firstweekday=0) can be used to generate HTML calendars. formatyear() method is one of the methods of HTMLCalendar instance. formatyear() method in Python is used to get year’s calendar as an HTML table.
Syntax: formatyear(year, width=3)
Parameter: year: year of the calendar
width:[Default value is 3] Specifies the width date column
Returns: Return an HTML table for an entire year.
Depends on the first weekday as specified in the constructor or set by the setfirstweekday() method.
Code #1:
Output:
Note that the earliest year for which a calendar can be generated is platform-dependent.
Code #2: width is given 5
Output: