Python ---接口返回值中文编码问题
# -*- coding: utf-8 -*- """ Created on Sun Mar 13 14:14:14 2021 @author: quliang """ import requests import json #输入客户名字查图 #url = "http:******888/searchPersonName" #输入天眼查公司cid查图 url = "http:*****nyId" # query = { # 'personName': '***', # 'pathDepth': 6 # } query = { 'companyID': 106511, 'pathDepth': 3 } headers = {'content-type': 'charset=utf8'} res = requests.post(url=url, json=query, headers=headers)
#解决办法 print(json.dumps(json.loads(res.text), ensure_ascii=False, indent=4, separators=(',', ':')))