itermonthdays()

monthMonth number for which dates are required
yearYear number for which dates are required
itermonthdays() : Returns an Iterator having days of the month including week days of previous and next month ( returned as 0 ) .

Note that days will be returned as 0 per the days of the week starting from Previous month and for days of the week extended up to next month.
import calendar
my_cal= calendar.Calendar()
for x in my_cal.itermonthdays(2020,7):
	print(x)
Output
0
0
1
2
3
4
5
--
--
28
29
30
31
0
0
By updating the first day of the week we can get different elements of the iterator.
import calendar
my_cal= calendar.Calendar(firstweekday=3)
for x in my_cal.itermonthdays(2020,7):
	print(x)
Output
0
0
0
0
0
0
1
2
3
4
--
--
--
27
28
29
30
31
0
0
0
0
0
Calendar Module in Python itermonthdays2() tuple with week days



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