itermonthdays()

Calendar Module

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



Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    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 FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer