Sunday, 26 June 2016

Python: Calendar module

Calendar module provides number of classes to provide UNIX cal functionality. All the classes provided by calendar module use Monday(0) as first day of the week and Sunday(6) as the last day of the week. You can use setfirstweekday method to set the first day of the week.

import calendar
calendar.setfirstweekday(calendar.SUNDAY)

Following are the classes provided by Calendar module.
Class
Description
Calendar
Used to create a Calendar object, By default Calendar instance use Monday as first day of the week and Sunday as the last day of the week.
TextCalendar
Used to generate plain text calendars.
HTMLCalendar
Used to generate HTML calendars.
LocaleTextCalendar
Sub class of TextCalendar, return month and weekday names in the specified locale.
LocaleHTMLCalendar
Sub class of HTMLCalendar, return month and weekday names in the specified locale.





Previous                                                 Next                                                 Home

No comments:

Post a Comment