Is there a built-in function to print all the current properties and values of an object?
You want vars() mixed with pprint(): from pprint import pprint pprint(vars(your_object))
You want vars() mixed with pprint(): from pprint import pprint pprint(vars(your_object))
Have you tried the __name__ attribute of the class? ie type(x).__name__ will give you the name of the class, which I think is what you want. >>> import itertools >>> x = itertools.count(0) >>> type(x).__name__ ‘count’ If you’re still using Python 2, note that the above method works with new-style classes only (in Python 3+ … Read more