On this page
calendar.Month
Prev: calendar.month | Up: calendar | Next: calendar.monthcalendar
Rel: calendar.calendar, calendar.Calendar, calendar.Day, calendar.firstweekday
Ref: docs.python.org — calendar.Month
Tags: #public #python3 #stdlib #calendar
Import
import calendar
from calendar import Month
Signature & Overview
calendar.Month(*values)
calendar.Month class.
Methods & Attributes
Month.as_integer_ratio(self, /)— Return a pair of integers, whose ratio is equal to the original int.Month.bit_count(self, /)— Number of ones in the binary representation of the absolute value of self.Month.bit_length(self, /)— Number of bits necessary to represent self in binary.Month.conjugate(self, /)— Returns self, the complex conjugate of any int.Month.from_bytes(bytes, byteorder='big', *, signed=False)— Return the integer represented by the given array of bytes.Month.is_integer(self, /)— Returns True. Exists for duck type compatibility with float.is_integer.Month.to_bytes(self, /, length=1, byteorder='big', *, signed=False)— Return an array of bytes representing an integer.
Usage
import calendar
assert calendar.Month.JANUARY == 1 and calendar.Month.DECEMBER == 12
Gotchas
- Requires Python 3.12+ (
IntEnum): 1-indexed (1..12), matchingdatetime.date.month.
REPL Inspect
from calendar import Month
help(Month)
Linked from
Related notes
- tuts/python3/stdlib_module/calendar/month Linked here; links to this page; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/monthcalendar 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