prmonth()

theyearYear number for which calendar of the month is returned
themonthMonth number for which calendar of the month is returned
wOptional , default =0 , width of date column
lOptional , default =0 , number of line each week will use
prmonth() : Prints the Monthly calendar .

import calendar
x=calendar.TextCalendar() # 
x.prmonth(2020,7,w=5,l=1)
Output
                July 2020
 Mon   Tue   Wed   Thu   Fri   Sat   Sun
               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
Based on the setting of first day of the week, the calendar first weekday can be set. Week day number starts from 0 as Monday , 1 as Tuesday and ends at 6 as Sunday.
import calendar
x=calendar.TextCalendar() 
x.setfirstweekday(4) # first week day is Friday
x.prmonth(theyear=2020,themonth=7,w=3,l=0)
Output
         July 2020
Fri Sat Sun Mon Tue Wed Thu
                      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
Calendar Module in Python itermonthdays() itermonthdays2() itermonthdays3()



Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com







Python Video Tutorials
Python SQLite Video Tutorials
Python MySQL Video Tutorials
Python Tkinter Video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer