I was trying to create some test data for an in book search we wrote for Openstax, and needed to format a dictionary that was being output. Found a pretty nifty way to do that:
import json
print json.dumps(my_dict, indent=2)
Go forth and make your dicts pretty…