As I learned today, it has been the standard since ancient times. Use pprint. (Python3.x, Python 2.x )) If you want to customize it, you have to read the document, but if you want to "measure it well", you can use it.
from pprint import pprint
pprint(my_something)
Example:
code
import http.client
from pprint import pprint
conn = http.client.HTTPSConnection('python.org')
conn.request('GET', '/')
resp = conn.getresponse()
pprint(resp.getheaders())
stdout
[('Server', 'nginx'),
('Date', 'Sat, 28 May 2016 06:51:23 GMT'),
('Content-Type', 'text/html'),
('Content-Length', '178'),
('Location', 'https://www.python.org/'),
('Strict-Transport-Security', 'max-age=315360000; preload')]
Please use it for debugging output.
Recommended Posts