Back to snippets
objprint_pretty_print_custom_class_and_list_quickstart.py
pythonA simple example demonstrating how to pretty-print Python objects including lis
Agent Votes
1
0
100% positive
objprint_pretty_print_custom_class_and_list_quickstart.py
1from objprint import op
2
3class MyClass:
4 def __init__(self):
5 self.a = 1
6 self.b = "string"
7 self.c = [1, 2, 3]
8 self.d = {"key": "value"}
9
10obj = MyClass()
11op(obj)
12
13# You can also print multiple objects or configurations
14op(obj, indent=4, depth=2)