2024-03-29 00:07:57 发布
网友
有什么标准方法可以得到Enumeration names by value?
Enumeration names by value?
例如:
class Example(enum.Enum): one = 1 two = 2 ex_variable = 1
给定ex_variable,我可以获得Example.one.name中包含的字符串吗?
ex_variable
>>> Example(1).name 'one'
还有see the Python docs。
到access the members of enums programatically:
>>> Example(ex_variable).name 'one'
还有see the Python docs。
到access the members of enums programatically:
相关问题 更多 >
编程相关推荐