Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get type of enum variable 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)
Comment

PREVIOUS NEXT
Code Example
Python :: win10 python com ports 
Python :: jupyter lab move tabs 
Python :: typing effect python 
Python :: cyclic rotation python 
Python :: django add list to manytomany 
Python :: Like strings (and all other built-in sequence type), lists can be indexed and sliced: 
Python :: containsDuplicate Set Solution 
Python :: get the first principle component of pca 
Python :: ring Loop Command 
Python :: ring load the odbclib.ring library 
Python :: easy ocr python pypi 
Python :: how to add log to a variable in plotly 
Python :: ring Desktop, WebAssembly and Mobile create an application to ask the user about his/her name. 
Python :: All objects and constants needed to use the ldap3 library can be imported from the ldap3 namespace 
Python :: get next element while looping 
Python :: unpack list python 
Python :: Find the 15th term of the series?0,0,7,6,14,12,21,18, 28 
Python :: websocket communitation to another pc python 
Python :: how to hash out a big paragraph in vs code python 
Python :: object creation using class constructor 
Python :: Capitalize first word of a phrase in python 
Python :: Pandas: Filter column value in array/list - ValueError: The truth value of a Series is ambiguous 
Python :: Parallel run of a function with multiple arguments partial 
Python :: sort key python 
Python :: np array blurring 
Python :: insert string into middle of list python 
Python :: where is memory and register in python python 
Python :: Access value 
Python :: python for infinite range 
Python :: How determine if a number is even or odd using bitwise operator 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =