2018-11-28
阅读量:
685
在 Python 中使用枚举量
我们可以用如下方法来创建枚举定义:
class Shapes:
Circle, Square, Triangle, Quadrangle = range(4)
print(Shapes.Circle)
print(Shapes.Square)
print(Shapes.Triangle)
print(Shapes.Quadrangle)
#1-> 0
#2-> 1
#3-> 2
#4-> 3






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论