itermonthdays()

Calendar Module

monthMonth number for which dates are requried
yearYear number for which dates are requried
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




plus2net.com



Post your comments , suggestion , error , requirements etc here




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