【发布时间】:2016-02-22 11:26:10
【问题描述】:
我想使用Python 库requests 发出JSON 请求,其中我只获得某些JSON 对象。
我知道将获取的 JSON 对象处理为仅关注所需信息确实很容易,但这会降低请求效率(以防重复执行)。
如前所述,我知道这是一种可能性:
url = 'www.foo.com'
r = requests.get(url).json()
#Do something with r[3]['data4'], the only one who is going to be used.
但是我怎么能直接从请求中获取r[3]['data4']呢?
【问题讨论】:
标签: python json python-requests