itermonthdays()
month | Month number for which dates are required |
year | Year 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
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com