Python 最小枚举 (enum.Enum) 示例
python-minimal-enum-enum-enum-example.py
from enum import Enum
class Shape(Enum):
Circle = 0
Square = 1
Hexagon = 2
# 使用示例
print(Shape.Square) # 打印 Shape.Square基于官方 enum 包文档。
Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow