Fetch the last day of the month in Python

Play this article

Python does not have a simple method to fetch the last day of the month. Instead, you need to use the monthrange() method from the calendar module as shown here. Not an inconvenience really.. 🤷‍♂️

>>> import calendar
>>> calendar.monthrange(2022, 2)[1]

Thanks for reading :)