python 枚举和字典

1

dict = {'name': '张三', 'age': 20}
print(dict['name']) # 输出张三

2

from enum import Enum

class Color(Enum):
    RED = 1
    GREEN = 2
    
print(Color.RED) # 输出Color.RED

你可能感兴趣的:(python基础,python,前端,linux)