Asked By – Jiloc
Are there any standard methods to get
Enumeration names by value?
class Example(enum.Enum): one = 1 two = 2 ex_variable = 1
ex_variable, can I obtain the string contained in Example.one.name?
Now we will see solution for issue: Get enumeration name by value [duplicate]
>>> Example(1).name 'one'
also see the Python docs.
This question is answered By – Nils Werner
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0