calendar module pyhton code example
Example 1: calendar program in python
import calendar
print("Your Calender\n \n ")
y = int(input("Enter the Year : "))
m = int(input("Enter the month : "))
try:
mycalender = calendar.month(y , m)
print("\n", mycalender)
except IndexError:
print("Its out of range")
Example 2: how to make sun as first day in calendar python
import calendar
calendar.setfirstweekday(calendar.SUNDAY)
print(calendar.month(2020, 10 ))
Example 3: python calendar
import calendar
yio = int(input('Input a month'))
s = int(input('Input a year'))
print(calendar.month(s,yio))
Example 4: python calendar table view
class CustomHTMLCal(calendar.HTMLCalendar):
cssclasses = [style + " text-nowrap" for style in
calendar.HTMLCalendar.cssclasses]
cssclass_month_head = "text-center month-head"
cssclass_month = "text-center month"
cssclass_year = "text-italic lead"