calendar.setfirstweekday
Prev: calendar.prmonth | Up: calendar | Next: calendar.TextCalendar
Rel: calendar.calendar, calendar.Calendar, calendar.Day, calendar.firstweekday
Ref: docs.python.org — calendar.setfirstweekday
Tags: #public #python3 #stdlib #calendar
Import
import calendar
from calendar import setfirstweekday
Signature & Overview
calendar.setfirstweekday(firstweekday)
calendar.setfirstweekday() function.
Usage
import calendar
orig = calendar.firstweekday()
calendar.setfirstweekday(calendar.SUNDAY)
try:
assert calendar.firstweekday() == calendar.SUNDAY
finally:
calendar.setfirstweekday(orig)
Gotchas
- Mutates module-global state: Prefer
calendar.TextCalendar(firstweekday=calendar.SUNDAY)to avoid side effects.
REPL Inspect
from calendar import setfirstweekday
help(setfirstweekday)
Linked from
Related notes
- tuts/python3/stdlib_module/calendar/prmonth Linked here; links to this page; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/TextCalendar Linked here; links to this page; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/calendar Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/Calendar_class Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/Day Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/firstweekday Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/calendar/HTMLCalendar shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/IllegalMonthError shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/IllegalWeekdayError shared tags: #calendar, #stdlib