Get enumeration name by value
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Meditation
--
Chapters
00:00 Question
00:29 Accepted answer (Score 327)
00:41 Answer 2 (Score 37)
00:54 Thank you
--
Full question
https://stackoverflow.com/questions/3871...
Accepted answer links:
[see the Python docs]: https://docs.python.org/3/library/enum.h...
Answer 2 links:
[access the members of enums programatically]: https://docs.python.org/3/library/enum.h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #enums #enumeration
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Meditation
--
Chapters
00:00 Question
00:29 Accepted answer (Score 327)
00:41 Answer 2 (Score 37)
00:54 Thank you
--
Full question
https://stackoverflow.com/questions/3871...
Accepted answer links:
[see the Python docs]: https://docs.python.org/3/library/enum.h...
Answer 2 links:
[access the members of enums programatically]: https://docs.python.org/3/library/enum.h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #enums #enumeration
#avk47
ACCEPTED ANSWER
Score 391
>>> Example(1).name
'one'
also see the Python docs.
ANSWER 2
Score 47
To access the members of enums programatically:
>>> Example(ex_variable).name
'one'