python get all variables and values of class code example
Example 1: python print class variables
# to print out the variable names
print(vars(YourClass))
# to print out names and values
for var in vars(YourClass):
print(getattr(YourClass, var))
Example 2: how to get all values from class in python
>>> an = Animal()
>>> attrs = vars(an)
#{'kids': 0, 'name': 'Dog', 'color': 'Spotted', 'age': 10, 'legs': 2, 'smell': 'Alot'}