python中获取json数组中的具体数值(调用百度AI返回的json数据)

最近在做软件杯的项目,想做一个人脸识别、对比的登录,当相似度超过某个数值时通过登录验证。

json数据:

{'error_code': 0, 'error_msg': 'SUCCESS', 'log_id': 9975359915559, 'timestamp': 1623377294, 'cached': 0, 'result': {'face_token': '08a7686ce58e74617f39f0f7f7af1b3e', 'user_list': [{'group_id': 'men', 'user_id': 'xm', 'user_info': '', 'score': 77.274261474609}]}}

我想要的数据:result中的user_list中的score

获取方法:

response = requests.post(request_url, data=params, headers=headers)
result1 = response.json()['result']['user_list'][0]['score']

  

结果:

原文地址:https://www.cnblogs.com/zhangxinyue/p/14874026.html