Python Glossary Русский

all Python 3calendarfunction

calendar.firstweekday()

first weekday

Returns the module's current global first weekday (0 is Monday), used by month(), monthcalendar() and the other module-level functions.

Syntax

calendar.firstweekday()

The setting is shared by the whole process: any call to setfirstweekday() changes it, including one inside a third-party library. Separate Calendar and TextCalendar instances ignore it — they have their own firstweekday. Do not confuse it with the Calendar.firstweekday attribute: here it is a function and needs parentheses.

Examples

import calendar
print(calendar.firstweekday())  # → 0
calendar.setfirstweekday(calendar.SUNDAY)
print(calendar.firstweekday())  # → 6

See also

Open in the full glossarydocs.python.orgReport an inaccuracy