from enum import IntEnum
class Type(IntEnum):
type0 = 0
type1 = type0 + 1
type2 = type1 + 1
type3 = type2 + 1
mylist = [1,2,3,4,5]
print(Type.type0)
print(mylist[Type.type3])
# 结果:
# Type.type0
# 4
from enum import IntEnum
class Type(IntEnum):
type0 = 0
type1 = type0 + 1
type2 = type1 + 1
type3 = type2 + 1
mylist = [1,2,3,4,5]
print(Type.type0)
print(mylist[Type.type3])
# 结果:
# Type.type0
# 4
>