python3 美化输出json

 

import json
a={'4': 5, '6': 7}
print(json.dumps(a, sort_keys=True, indent=4))



输出
{
    "4": 5,
    "6": 7
}

 

posted @ 2020-01-07 17:20  anobscureretreat  阅读(1934)  评论(0编辑  收藏  举报