Is there a way to print out all the attributes of a python object along with their values
For example, for the following class and object
class man:
def __init__(self):
name = "jim"
age = 2
him = man()
I want to print out all the attributes of the object "him" as well as their values. I want some kind of code that acts like the following
for variable_name of him:
print variable_name," : ",him.variable_name
should print out
name : jim
age : 2
Is there any way to do that in python?