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