python - pprint(): how to use double quotes to display strings? -


if print dictionary using pprint, wraps strings around single quotes ('):

>>> pprint import pprint >>> pprint({'aaa': 1, 'bbb': 2, 'ccc': 3}) {'aaa': 1, 'bbb': 2, 'ccc': 3} 

is there way tell pprint use double quotes (") instead? have following behaviour:

>>> pprint import pprint >>> pprint({'aaa': 1, 'bbb': 2, 'ccc': 3}) {"aaa": 1, "bbb": 2, "ccc": 3} 

it looks trying produce json; if so, use json module:

>>> import json >>> print json.dumps({'aaa': 1, 'bbb': 2, 'ccc': 3}) {"aaa": 1, "bbb": 2, "ccc": 3} 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -