Example 1: Python implementation of the calendar module
kw.py
import calendar
for m in calendar.month_name:
    print(m)
print("")
for d in calendar.day_name:
    print(d)
Output
kodingwindow@kw:~$ python3 kw.py

January
February
March
April
May
June
July
August
September
October
November
December

Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Example 2: Python implementation of the calendar module
kw.py
import calendar
cal=calendar.month(2020,5)
print(cal)

cal=calendar.TextCalendar(calendar.FRIDAY)
print(cal.formatmonth(2020,5))
Output
kodingwindow@kw:~$ python3 kw.py
      May 2020
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

      May 2020
Fr Sa Su Mo Tu We Th
 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
Example 3: Python implementation of the calendar module
kw.py
import calendar
cal=calendar.month(2020,5)
print(calendar.TextCalendar(calendar.MONDAY).formatyear(2020,5,1,1,2))
Output
kodingwindow@kw:~$ python3 kw.py
                                        2020

                 January                                    February
 Mon   Tue   Wed   Thu   Fri   Sat   Sun    Mon   Tue   Wed   Thu   Fri   Sat   Sun
               1     2     3     4     5                                    1     2
   6     7     8     9    10    11    12      3     4     5     6     7     8     9
  13    14    15    16    17    18    19     10    11    12    13    14    15    16
  20    21    22    23    24    25    26     17    18    19    20    21    22    23
  27    28    29    30    31                 24    25    26    27    28    29

                  March                                      April
 Mon   Tue   Wed   Thu   Fri   Sat   Sun    Mon   Tue   Wed   Thu   Fri   Sat   Sun
                                       1                  1     2     3     4     5
   2     3     4     5     6     7     8      6     7     8     9    10    11    12
   9    10    11    12    13    14    15     13    14    15    16    17    18    19
  16    17    18    19    20    21    22     20    21    22    23    24    25    26
  23    24    25    26    27    28    29     27    28    29    30
  30    31

                   May                                        June
 Mon   Tue   Wed   Thu   Fri   Sat   Sun    Mon   Tue   Wed   Thu   Fri   Sat   Sun
                           1     2     3      1     2     3     4     5     6     7
   4     5     6     7     8     9    10      8     9    10    11    12    13    14
  11    12    13    14    15    16    17     15    16    17    18    19    20    21
  18    19    20    21    22    23    24     22    23    24    25    26    27    28
  25    26    27    28    29    30    31     29    30

                   July                                      August
 Mon   Tue   Wed   Thu   Fri   Sat   Sun    Mon   Tue   Wed   Thu   Fri   Sat   Sun
               1     2     3     4     5                                    1     2
   6     7     8     9    10    11    12      3     4     5     6     7     8     9
  13    14    15    16    17    18    19     10    11    12    13    14    15    16
  20    21    22    23    24    25    26     17    18    19    20    21    22    23
  27    28    29    30    31                 24    25    26    27    28    29    30
                                             31

                September                                   October
 Mon   Tue   Wed   Thu   Fri   Sat   Sun    Mon   Tue   Wed   Thu   Fri   Sat   Sun
         1     2     3     4     5     6                        1     2     3     4
   7     8     9    10    11    12    13      5     6     7     8     9    10    11
  14    15    16    17    18    19    20     12    13    14    15    16    17    18
  21    22    23    24    25    26    27     19    20    21    22    23    24    25
  28    29    30                             26    27    28    29    30    31

                 November                                   December
 Mon   Tue   Wed   Thu   Fri   Sat   Sun    Mon   Tue   Wed   Thu   Fri   Sat   Sun
                                       1            1     2     3     4     5     6
   2     3     4     5     6     7     8      7     8     9    10    11    12    13
   9    10    11    12    13    14    15     14    15    16    17    18    19    20
  16    17    18    19    20    21    22     21    22    23    24    25    26    27
  23    24    25    26    27    28    29     28    29    30    31
  30
Advertisement