I have following enum defined
from enum import Enum class D(Enum): x = 1 y = 2 print(D.x)
now the printed value is
<
I implemented access using the following
class D(Enum): x = 1 y = 2 def __str__(self): return '%s' % self.value
now I can just do
print(D.x) to get 1 as result.
print(D.x)
1
You can also use self.name in case you wanted to print x instead of 1.
self.name
x