pprint(): how to use double quotes to display strings?
If I print a dictionary using pprint , it always wraps strings around single quotes ( ' ): >>> from pprint import pprint >>> pprint({'AAA': 1, 'BBB': 2, 'CCC': 3}) {'AAA': 1, 'BBB': 2, 'CCC': 3} Is there any way to tell pprint to use double quotes ( " ) instead? I would like to have the following behaviour: >>> from pprint import pprint >>> pprint({'AAA': 1, 'BBB': 2, 'CCC': 3}) {"AAA": 1, "BBB": 2, "CCC": 3} It looks like you are trying to produce JSON; if so, use the json module : >>> import json >>> print json.dumps({'AAA': 1, 'BBB': 2, 'CCC': 3}) {"AAA": 1, "BBB": 2, "CCC": 3} The pprint()