Created
May 8, 2018 15:06
-
-
Save madsc13ntist/8389815e82523e0afd85e3f0b7e45db4 to your computer and use it in GitHub Desktop.
A simple function that prints a representation of any object. Just feed it a variable and enjoy an exploded view.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pprint import pprint | |
| def explode(obj): | |
| """ | |
| explode(obj) | |
| List contents of 'obj' | |
| :param obj: an object to explore. | |
| :return: | |
| """ | |
| try: | |
| pprint(vars(obj), indent=2) | |
| except TypeError: | |
| pprint(dir(obj), indent=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment