枚举的问题
来源:11-6 枚举转换
一直2下去3482599
2018-01-30
上课案例讲到枚举的时候 print(Vip),print(Vip.Red), print(Vip.Red.name) ,print(Vip['Red'])
哪个是枚举类型,哪个是枚举的值,哪个是枚举的名字???
class Vip(Enum):
Red = 1
Red1 = 1
Yellow = 2
Green = 3
Black = 4
White = 5
print(Vip)
print(type(Vip))
print('--------------------------1')
print(Vip.Red)
print((type(Vip.Red)))
print('--------------------------2')
print(Vip.Red.name)
print(type(Vip.Red.name))
print('--------------------------3')
print(Vip['Red'])
print(type(Vip['Red']))
写回答
1回答
-
7七月
2018-01-30
你把定义枚举的代码贴一下
042018-01-30
相似问题