import pprint my_dict = {"name": "John", "age": 30, "city": "New York"} pp = pprint.PrettyPrinter(indent=4) # Create a PrettyPrinter object with an indentation of 4 spaces pp.pprint(my_dict) # Use the pprint() method to pretty print the dictionary
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter