Python Calendar Module : yeardays2calendar() method
yeardays2calendar() method
The yeardays2calendar() method is used to get the data for the specified year ready for formatting. The method is similar to yeardatescalendar().
Entries in the week lists are tuples of day numbers and weekday numbers.
Day numbers outside this month are zero.
Syntax:
yeardays2calendar(year, width=3)
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
year | Year for which the calendar should be generated. | Required | Number |
width | The number of months to include in each row. Default: 3 | Required | Number |
Example of yeardays2calendar() method
import calendar
cal= calendar.Calendar()
print(cal.yeardays2calendar(2016, 5))
Output:
[[[[(0, 0), (0, 1), (0, 2), (0, 3), (1, 4), (2, 5), (3, 6)], [(4, 0), (5, 1), (6, 2), (7, 3), (8, 4), (9, 5), (10, 6)], [(11, 0), (12, 1),
(13, 2), (14, 3), (15, 4), (16, 5), (17, 6)], [(18, 0), (19, 1), (20, 2), (21, 3), (22, 4), (23, 5), (24, 6)], [(25, 0), (26, 1),
(27, 2), (28, 3), (29, 4), (30, 5), (31, 6)]], [[(1, 0), (2, 1), (3, 2), (4, 3), (5, 4), (6, 5), (7, 6)], [(8, 0), (9, 1), (10, 2),
(11, 3), (12, 4), (13, 5), (14, 6)], [(15, 0), (16, 1), (17, 2), (18, 3), (19, 4), (20, 5), (21, 6)], [(22, 0), (23, 1), (24, 2),
(25, 3), (26, 4), (27, 5), (28, 6)], [(29, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6)]], [[(0, 0), (1, 1), (2, 2), (3, 3),
(4, 4), (5, 5), (6, 6)], [(7, 0), (8, 1), (9, 2), (10, 3), (11, 4), (12, 5), (13, 6)], [(14, 0), (15, 1), (16, 2), (17, 3), (18, 4),
(19, 5), (20, 6)], [(21, 0), (22, 1), (23, 2), (24, 3), (25, 4), (26, 5), (27, 6)], [(28, 0), (29, 1), (30, 2), (31, 3), (0, 4), (0, 5), (0, 6)]], ... [[(0, 0), (0, 1), (0, 2), (1, 3), (2, 4), (3, 5), (4, 6)], [(5, 0), (6, 1), (7, 2), (8, 3), (9, 4), (10, 5), (11, 6)], [(12, 0), (13, 1),
(14, 2), (15, 3), (16, 4), (17, 5), (18, 6)], [(19, 0), (20, 1), (21, 2), (22, 3), (23, 4), (24, 5), (25, 6)], [(26, 0), (27, 1),
(28, 2), (29, 3), (30, 4), (31, 5), (0, 6)]]]]
Previous: yeardatescalendar()
Next: yeardayscalendar()
Test your Python skills with w3resource's quiz
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/yeardays2calendar.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics