2012-10-02

How to print all the attributes of an object in python

from pprint import pprint
pprint (vars(my_object))     # e.g. class instance
 
 
This prints all the attributes/properties this object currently has in a neat way.

No comments:

Post a Comment