w3resource

Python TextCalendar: prmonth() method

prmonth() method

The prmonth() method is used to print a month’s calendar as returned by formatmonth().

Syntax:

prmonth(theyear, themonth, w=0, l=0)

Parameters:

Name Description Required /
Optional
Type
year Year for which the calendar should be generated. Required Number
month Month for which the calendar should be generated. Required Number
w The width between two columns. Default value is 0. Optional Number
l Blank line between two rows. Default value is 0. Optional Number

Example of Text-calendar-prmonth() method

import calendar
tc= calendar.TextCalendar(firstweekday=0)
print(tc.prmonth(2016, 5))

Output:

 May 2016
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

Previous: formatmonth()
Next: Python HTMLCalendar Class formatmonth()

Test your Python skills with w3resource's quiz



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/python/module/calendar/text-calendar-prmonth.php