首页 > Web开发 > 详细

request提取json中的信息

时间:2020-08-20 16:34:53      阅读:62      评论:0      收藏:0      [点我收藏+]
 1 import requests
 2 
 3 response = requests.get(host)
 4 
 5 #无需import json库
 6 
 7 i = respon.json()
 8 
 9 #此时可用字典的方式查询,例如
10 print(i[‘‘words_result])
11 #若子项是list,可用for循环+字典将子项的查询项打印,例如
12 for index in i()[words_result]:
13     print(index[words])
14 
15 #同名项也是for打印

 

request提取json中的信息

原文:https://www.cnblogs.com/shenghouchou/p/13535387.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!