# How to set the first day of each week to weekday using Python?

PythonServer Side ProgrammingProgramming

You can set the first day of each week to weekday in Python. In the calender module there is a function, setfirstweekday() that helps you to set the first day of each week to the code of the weekday you provide to it. Note that setfirstweekday affects only display functions like prmonth.

## Example

import calendar
print(calendar.prmonth(2018, 1))
calendar.setfirstweekday(calendar.SUNDAY)
print(calendar.prmonth(2018, 1))

## Output

This will give the output −

    January 2018
Mo Tu We Th Fr Sa Su
1  2  3  4  5  6  7
8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
January 2018
Su Mo Tu We Th Fr Sa
1  2  3  4  5  6
7  8  9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Published on 08-Jan-2018 09:48:17