Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (1.6k points)

I want to calculate the number of days present in a given month in Python.


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?

1 Answer

0 votes
by (25.1k points)

You can simply use the monthrange method from the calendar module. Like this:

from calendar import monthrange

monthrange(2019, 8)

Related questions

Browse Categories