Back

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

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?

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

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.2k users

Browse Categories

...