Python TextCalendar - formatyear() and pryear()

Python tip:

You can output a calendar year as a multi-line string using Python's calendar module.

You need to provide the year, and you can impact how it looks with optional parameters.

You can use formatyear to get the string or pryear to directly print the output.

import calendar

cal = calendar.TextCalendar()
year = cal.formatyear(2022, m=4)


# or 

cal.pryear(2022, m=4)