Thursday 30 June 2016

Python: Calendar: itermonthdays(year, month): Return day numbers for given month

itermonthdays(year, month)

Returns an iterator for given month in given year. Days returned will simply be day numbers.
>>> from calendar import Calendar
>>> cal1=Calendar()
>>> iter=cal1.itermonthdays(2015, 11)
>>> for day in iter:
...     print(day)
... 
0
0
0
0
0
0
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
0
0
0
0
0
0


Previous                                                 Next                                                 Home

No comments:

Post a Comment