Methods | Description |
---|---|
prcal(year) | Prints the whole calendar of the year. |
firstweekday() | Returns the first week day. It is by default 0 which specifies Monday |
isleap(year) | Returns a Boolean value i.e., true or false. True in case given year is leap else false. |
monthcalendar(year,month) | Returns the given month with each week as one list. |
leapdays(year1,year2) | Return number of leap days from year1 to year2 |
prmonth(year,month) | Print the given month of the given year |
>>> import calendar
>>> calendar.prcal(2017)
>>> import calendar
>>> print (calendar.firstweekday())
0
>>>
>>> import calendar
>>> print (calendar.isleap(2017))
False
>>>
>>> import calendar
>>> print (calendar.monthcalendar(2017,8))
[[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, 31, 0, 0, 0]]
>>>
>>> import calendar
>>> print (calendar.prmonth(2017,8))
August 2017
Mo Tu We Th Fr Sa Su
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 31
None
>>>