Source Code:
(back to article)
from enum import Enum Color = Enum('Color', ['RED', 'GREEN', 'BLUE']) print(Color.RED.name) # prints 'RED' print(Color.RED.value) # prints 1
Result:
Report an issue