{"id":26009,"date":"2021-12-07T18:06:49","date_gmt":"2021-12-07T12:36:49","guid":{"rendered":"https:\/\/python-programs.com\/?p=26009"},"modified":"2021-12-08T20:41:17","modified_gmt":"2021-12-08T15:11:17","slug":"python-program-for-calendar-formatyear-method-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-calendar-formatyear-method-with-examples\/","title":{"rendered":"Python Program for calendar formatyear() Method with Examples"},"content":{"rendered":"

Calendar Module:<\/strong><\/p>\n

The calendar module allows you to output calendars like a program and includes extra calendar-related operations. Calendar module functions and classes make use of an idealized calendar, the current Gregorian calendar extended in both directions indefinitely.<\/p>\n

formatyear() Method:<\/strong><\/p>\n

The formatyear() method returns a multi-line string containing an m-column calendar for a full year.<\/p>\n

To generate plain text calendars, class calendar.TextCalendar(firstweekday=0) can be used.The formatyear() method is one of the TextCalendar instance’s methods.<\/p>\n

Syntax:<\/strong><\/p>\n

formatyear(year, width=2, lines=1, c=6, m=3)<\/pre>\n

Parameter Values:<\/strong><\/p>\n

year:<\/strong> This is required. It is a number. It is the year for which the calendar should be created.<\/p>\n

width:<\/strong> This is Optional. It is a number. The distance between two columns. 2<\/strong> is the default value.<\/p>\n

lines:<\/strong> This is Optional. It is a number. A blank line between two rows. 1<\/strong> is the default value.<\/p>\n

c:<\/strong> This is Optional. It is a number. It is the space between two months (column-wise). 6<\/strong> is the default value.<\/p>\n

m:<\/strong> This is Optional. It is a number. It is the number of months in a row. 3 is the default value.<\/p>\n

Return Value:<\/strong> A m-column calendar for the whole year is returned.<\/p>\n

Program for calendar formatyear() Method with Examples in Python<\/h2>\n