Получить тип переменной перечисления Python
# Python code to demonstrate enumerations
# importing enum for enumerations
import enum
# creating enumerations using class
class Animal(enum.Enum):
dog = auto()
cat = auto()
lion = auto()
# printing enum member as string
print ("The string representation of enum member is : ",end="")
print (Animal.dog)
# printing enum member as repr
print ("The repr representation of enum member is : ",end="")
print (repr(Animal.dog))
# printing the type of enum member using type()
print ("The type of enum member is : ",end ="")
print (type(Animal.dog))
# printing name of enum member using "name" keyword
print ("The name of enum member is : ",end ="")
print (Animal.dog.name)
Encouraging Elephant