Python Glossary Русский

all Python 3calendarfunction

calendar.weekheader()

printing calendars

Returns a header string with weekday names abbreviated to the given width.

Syntax

calendar.weekheader(width)

The width truncates the names: 2 gives Mo Tu, 3 gives Mon Tue, and from 9 upwards full names are printed. The order follows the global setfirstweekday(), and the language follows the process locale. For your own header with another first day prefer TextCalendar(firstweekday).formatweekheader(width).

Examples

import calendar
print(calendar.weekheader(2))  # → Mo Tu We Th Fr Sa Su
print(calendar.weekheader(1))  # → M T W T F S S

See also

Open in the full glossarydocs.python.orgReport an inaccuracy