w3resource

Python HTMLCalendar Module: setfirstweekday() method

setfirstweekday() method

The setfirstweekday() method sets the weekday (0 is Monday, 6 is Sunday) to start each week.
The values MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, and SUNDAY are provided for convenience.

Syntax:

setfirstweekday()

Example of setfirstweekday() method

The following code set the first weekday to Sunday:

import calendar
calendar.setfirstweekday(calendar.SUNDAY)

Previous: formatyearpage()
Next: firstweekday()

Test your Python skills with w3resource's quiz



Share this Tutorial / Exercise on : Facebook and Twitter

Python: Tips of the Day

Getting rid of unwanted characters:

You can get rid of whitespaces or any specific character using strip methods in Python. You can use either plain strip for both sides, lstrip for the left side and rstrip for the right side only.

str="+++Welcome python+++"
str.strip()

print(str)

Output:

+++Welcome python+++