相关疑难解决方法(0)

按值获取枚举名称

有没有标准方法可以获得 Enumeration names by value?

一个例子:

class Example(enum.Enum):
    one = 1
    two = 2

ex_variable = 1
Run Code Online (Sandbox Code Playgroud)

给定ex_variable,我可以获取Example.one.name中包含的字符串吗?

python enums enumeration

39
推荐指数
2
解决办法
3万
查看次数

标签 统计

enumeration ×1

enums ×1

python ×1