Back
I want to calculate the number of days present in a given month in Python.
Ex-
suppose user inputs Feb 2019 then the output should be 28 days.
Can suggest me a library in Python which will help me to determine the no. of days of a given month?
You can simply use the monthrange method from the calendar module. Like this:
from calendar import monthrangemonthrange(2019, 8)
from calendar import monthrange
monthrange(2019, 8)
31k questions
32.8k answers
501 comments
693 users