w3resource

Python TextCalendar: pryear() method

pryear() method

The pryear() method is used to print the calendar for an entire year as returned by formatyear().

Syntax:

pryear(theyear, w=2, l=1, c=6, m=3)

Parameters:

Name Description Required /
Optional
Type
year Year for which the calendar should be generated. Required Number
w The width between two columns. Default value is 2. Optional Number
l Blank line between two rows. Default value is 1. Optional Number
c Space between two months (Column wise). Default value is 6. Optional Number
m Number of months in a row. Default value is 3. Optional Number

Example of Text-calendar-pryear() method

import calendar
tc= calendar.TextCalendar(firstweekday=0)
print(tc.pryear(2016, 5))

Output:

2016

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

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

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

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

Previous: formatyear()
Next: Python HTMLCalendar Class formatmonth()

Test your Python skills with w3resource's quiz



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/python/module/calendar/text-calendar-pryear.php