Not a duplicate of: enum - getting value of enum on string conversion.
The question here is about how to the get Enum
name (left part) converted to a string, not the value (right part).
With the following Enum
:
class test(Enum):
aa = 1
bb = 2
I can do this:
v = test.aa
print(v)
and I get:
test.aa
but how do I convert v
to a string?