Python enum 与 int 之间的转换
class eOperator(enum.Enum):
unknown = 0
equal = 1
gt = 2
gte = 3
lt = 4
lte = 5
注意千万不要写成:
class eOperator(enum.Enum):
unknown = 0,
equal = 1,
gt = 2,
......
这样会只能识别最后一个
从int 转为 enum:
op = eOperator(1)