Possible Duplicate:
How can I represent an 'enum' in Python?
Python 中枚举的常见做法是什么? IE。它们是如何在 Python 中复制的?
public enum Materials
{
Shaded,
Shiny,
Transparent,
Matte
}
最佳答案
class Materials:
Shaded, Shiny, Transparent, Matte = range(4)
>>> print Materials.Matte
3
关于python - Python中枚举的常见做法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/702834/