For finding last day of current month, we need to use calendar and datetime python libraries.
Following is an example of it.
>>> import calendar
>>> import datetime
>>> calendar.mdays[datetime.date.today().month]
31
Following is an example of it.
>>> import calendar
>>> import datetime
>>> calendar.mdays[datetime.date.today().month]
31
>>> datetime.datetime.today().replace(day=1)
It will replace today's date with starting date of month.
I hope you like this article. Share your views to improve content. Happy Learning !!!