python enum 判断key 或者value是否存在

python enum 判断key 或者value是否存在

https://www.cnblogs.com/ibingshan/p/10303794.html

from enum import Enum
class testEnum(int,Enum):
     key1 = 0
     key2 = 1

"key1" in testEnum.__members__
0 in testEnum._value2member_map_
posted @ 2020-12-25 15:00  不要摸我的腰  阅读(856)  评论(0编辑  收藏  举报