In [1]:
import calendar
import pprint

In [2]:
print(calendar.month(2019, 3))


     March 2019
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


In [3]:
pprint.pprint(calendar.monthcalendar(2019, 3))


[[0, 0, 0, 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]]

In [4]:
print(len(calendar.monthcalendar(2019, 3)))


5

In [5]:
calendar.setfirstweekday(calendar.SUNDAY)

In [6]:
print(calendar.month(2019, 3))


     March 2019
Su Mo Tu We Th Fr Sa
                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


In [7]:
pprint.pprint(calendar.monthcalendar(2019, 3))


[[0, 0, 0, 0, 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, 0, 0, 0]]

In [8]:
print(len(calendar.monthcalendar(2019, 3)))


6

In [9]:
print(calendar.MONDAY)


0

In [10]:
print(calendar.SUNDAY)


6

In [11]:
calendar.setfirstweekday(0)

In [12]:
print(calendar.firstweekday())


0