How to get first day of the week using Python?



You can use the calender module to get the first day of the week using Python. The calender module has a special function, firstweekday(), that returns the current setting for the weekday to start each week.

Example

import calendar
print(calendar.firstweekday())
calendar.setfirstweekday(2)
print(calendar.firstweekday())

Output

This will give the output −

6
2
Updated on: 2020-06-12T11:54:08+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements