Answers for "how to print dict with indentation in python"

4

python print dict pretty

>>> import json
>>> print json.dumps({'a':2, 'b':{'x':3, 'y':{'t1': 4, 't2':5}}},
...                  sort_keys=True, indent=4)
{
    "a": 2,
    "b": {
        "x": 3,
        "y": {
            "t1": 4,
            "t2": 5
        }
    }
}
Posted by: Guest on November-25-2020

Code answers related to "how to print dict with indentation in python"

Python Answers by Framework

Browse Popular Code Answers by Language