SyntaxFix
Write A Post
Hire A Developer
Questions
You can use IntEnum:
from enum import IntEnum class Color(IntEnum): RED = 1 BLUE = 2 print(int(Color.RED)) # prints 1
To get list of the ints:
enum_list = list(map(int, Color)) print(enum_list) # prints [1, 2]