Saturday 2 July 2016

Python: Calendar: monthdayscalendar(year, month)

monthdayscalendar(year, month)
Returns list of weeks in given month in given year. Weeks are lists of seven day numbers.
>>> from calendar import Calendar
>>> iter=cal1.monthdayscalendar(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