python get all object attributes code example
Example 1: print items in object python
def (myObject):
print(vars(myObject))
Example 2: python get attributes of object
getattr(object, 'attribute_name')
Example 3: see attributes of object python
>>> class new_class():
... def __init__(self, number):
... self.multi = int(number) * 2
... self.str = str(number)
...
>>> a = new_class(2)
>>> a.__dict__
{'multi': 4, 'str': '2'}
>>> a.__dict__.keys()
dict_keys(['multi', 'str'])
Example 4: how to get all values from class in python
>>> an = Animal()
>>> attrs = vars(an)