Python 라이브러리 - pprint

공식 문서

source code

pprint는 데이터를 보기 좋게 출력(pretty print)할 때 사용하는 모듈입니다.

import pprint

result = {'userId': 1, 'id': 1, 'title': 'hi', 'body': 'https://docs.python.org/ko/3/library/pprint.html'}
pprint.pprint(result)
# {'body': 'https://docs.python.org/ko/3/library/pprint.html',
#  'id': 1,
#  'title': 'hi',
#  'userId': 1}

pprint는 주로 구조가 복잡한 JSON 데이터를 디버깅 용도로 출력할 때 사용합니다.

 

 

 

 

'Python > Python' 카테고리의 다른 글

Python 라이브러리 - math  (0) 2023.05.16
Python 라이브러리 - enum  (0) 2023.05.16
Python 라이브러리 - heapq  (0) 2023.05.16
Python 라이브러리 - collections  (0) 2023.05.11
Python 라이브러리 - calendar  (0) 2023.05.11