Python weekday() method from the calendar module
Python tip:
Use
weekday
from thecalendar
module to get a day in a week (0
is Monday) for a specific date.An example👇
import calendar days = { 0: "Monday", 1: "Tuesday", 2: "Wednesday", 3: "Thursday", 4: "Friday", 5: "Saturday", 6: "Saturday", } day_in_week = calendar.weekday(1975, 10, 23) print(days[day_in_week]) # Thursday