Guest User

Untitled

a guest
Nov 18th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import jsonpickle # pip install jsonpickle
  2. import json
  3.  
  4. def pprint_obj(obj, max_depth=None):
  5. """
  6. Pretty print all attributes of an object recursively.
  7.  
  8. Arguments:
  9. obj (object): object whose attributes are to be printed
  10. max_depth (int, optional): maximum recursion depth
  11. """
  12. serialized = jsonpickle.encode(obj, max_depth=max_depth)
  13. return json.dumps(json.loads(serialized), indent=4)
Add Comment
Please, Sign In to add comment