python 的基本用法请浏览:https://www.cnblogs.com/ibingshan/p/9856424.html

这里讨论如何判断 key(键) 或者 value(值)是否在枚举中

1 from enum import Enum
2 class testEnum(Enum):
3     key1 = 0
4     key2 = 1
5 
6 "key1" in testEnum.__members__
7 0 in testEnum._value2member_map_

 

相关文章: