Find the first day of the month
Find the week day of the first day of month using calendar module
Python: 3.0    Anurag Rana    13 Jul 2021   0
Login to upvote
1
2
3
4
5
6
import calendar

first_day, number_of_days_month = calendar.monthrange(2021, 6)

print(calendar.day_name[first_day]) # Tuesday
print(number_of_days_month) # 30
Copy | Download as: .py file   PNG
Share on: FB   Twitter   LinkedIn   WA
©2021 - code108labs   Contributors   Hosted on DigitalOcean   Partner website: pythoncircle.com