Python TextCalendar Module: monthrange() method
monthrange() method
The monthrange() method is used to get weekday of first day of the month and number of days in month, for the specified year and month.
Syntax:
monthrange(year, month)
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
year | Year to get weekday of the first day of the month and number of days in month. | Required | Number |
month | Month to get weekday of the first day of the month and number of days in a month. | Required | Number |
Example of monthrange() method
import calendar
print(calendar.monthrange(2016,5))
Output:
(6, 31)
Previous: weekheader()
Next: monthcalendar()
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://198.211.115.131/python/module/calendar/monthrange.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics