728x90
Python json pretty print
import json
test = {'a': 1, 'b': 2}
print(json.dumps(test, sort_keys=True, indent=2, separators=(',', ': ')))
""" 아래와 같이 출력됩니다.
{
"a": 1,
"b": 2
}
"""
728x90
'Python' 카테고리의 다른 글
Python animated gif 체크 방법 (0) | 2019.08.13 |
---|---|
Python 네이버 블로그 글쓰기 (0) | 2017.07.02 |
Python AES 암/복호화 (0) | 2017.07.02 |