Enumerations for Named Constants in Python


Define enumerations for groups of related constants.

Source Code

from enum import Enum
class Color(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3
print(Color.RED)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments