Python's monthrange() method
Python tip:
You can use
monthrange
from thecalendar
module to get the weekday of the first day in a month and the number of days in a month.An example👇
import calendar weekday, number_of_days = calendar.monthrange(2021, 2) print(calendar.day_name[weekday], number_of_days) # Monday 28