Python calendar Module Methods

Python calendar Module has the following built-in functions.

Method Description
calendar() Returns a 3-column calendar for an entire year.
firstweekday() Returns the current setting for the weekday to start each week.
isleap() Returns true if the year is leap else returns false.
leapdays() Returns the number of leap days between the two given years in the function argument.
month() Returns a multi-line string representation of the given month's calendar.
monthcalendar() Returns a matrix representing the given month's calendar.
monthrange() Returns a tuple where the first value is the weekday of first day of the month and the second value is the number of days in month, for the specified year and month.
prcal() Prints the calendar of the specific year. Also, there is no need for "print" operation to execute this.
prmonth() Prints the calendar of the given month of the given year. Also, there is no need of "print" operation to execute this.
setfirstweekday() Sets the first weekday from when the week should start. Here, Monday is 0, incrementing by 1 till Sunday, which is 6.
weekday() Returns what is the day of the week for the given year, month and day mentioned in the function argument.
weekheader() Returns a header containing the abbreviated names of the weekday.


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.