
对于python中request请求得到的响应 response.json()是一行json数据,查看起来很不方便,这时可以使用 json.dumps()进行格式化输出。
import json
response_body = json.dumps(response.json(), sort_keys=True, indent=4, separators=(',', ':'))
print(response_body)
欢迎分享,转载请注明来源:内存溢出

import json
response_body = json.dumps(response.json(), sort_keys=True, indent=4, separators=(',', ':'))
print(response_body)
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)