有没有童鞋遇到过同样的问题:python如何提取接口返回的data里面的数据?求老司机指点!

print(json.loads(r.content))打印结果是下面的内容可是我想要data里面的某些字段的信息请问怎么取呢?
{"ok":1,"data":{"cardlistInfo":{"containerid":"1076035541210428","v_p":42,"show_style":1,"total":5164,"page":4},"cards":[{"card_type":9,"itemid":"1076035541210428_-_4403110468243397","scheme":"https:\/\/m.weibo.cn\/status\/I1iUSyAu1?mblogid=I1iUSyAu1&luicode=10000011&lfid=1076035541210428","mblog":{"visible":{"type":0,"list_id":0},"created_at":"08-08","id":"4403110468243397","idstr":"4403110468243397","mid":"4403110468243397","can_edit":false,"show_additional_indication":0,"text":"\u54c8\u54c8\u54c8\u54c8\u54c8\uff0c\u592a\u96be\u4e86\uff01<\/span><\/span>#\u54c8\u58eb\u5947\u641e\u7b11\u89c6\u9891#<\/span><\/a>
偶然的你
浏览 575回答 2
2回答

海绵宝宝撒

如果是requests模块发起请求importrequestsresult=requests.get('xx')#result.json()就是json对象ifresult.status_code==200:print(result.json().get('data'))
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript