import calendar
select_year = 2021
select_month = 11
print(calendar.month(select_year, select_month))
# November 2021
# 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
In the code snippet, we want to print the calendar for the year 2021 and the month of November. First, we need to import the calendar module into our project. To do that we can use the below code.
import calendar
Next, we can use the calendar.month(year, month) method to print the whole month as shown in the above code.
0 Comments