pretty print

PHOTO EMBED

Wed Mar 22 2023 21:12:52 GMT+0000 (Coordinated Universal Time)

Saved by @praveenms079 #python #pprint

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
content_copyCOPY