What is prmonth() method in python?


Python has an built-in module named Calendar that contains classes and functions to support a different varity of calendar operations,by default the calendar module follows the Gregorian calendar. 

prmonth() method is one of the methods of TextCalendar instance.is used to print a month’s calendar as returned by formatmonth().

 Syntax: prmonth(year, month, width=0, lines=0) 

The arguments passed to this function are the year (yyyy), month (m), date column width (w), and the number of lines per week (l), respectively. For example, let's use this function to print the calendar of May, 2019:

Example

#importing calendar
import calendar
#let say 'i' is an variable
i = calendar.TextCalendar()
#printing the prmonth
print(i.prmonth(2019, 5))

Output

May 2019
Mo Tu We Th Fr Sa Su
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
None

Sri
Sri

Updated on: 30-Jul-2019

117 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements