from enum import Enum
class Shake(Enum):
__order__ = 'vanilla chocolate cookies mint' # only needed in 2.x
vanilla = 7
chocolate = 4
cookies = 9
mint = 3
for shake in Shake:
print shake
运行此代码时出错
^{pr2}$
Python2.7中的Enum
不支持迭代吗?如果我们创建一个Enum
类型的对象,就可以了。在
Tags:
python3.4枚举类型的后端口是enum34,而不是{a2}。在
相关问题 更多 >
编程相关推荐