用Python抓取JSON数据

时间:2018-04-12 15:04:32

标签: python

尝试从链接中抓取以下json数据:我正在尝试获取“ID'列表中的值

{"lister":[{"id":12345,"name":"ES","only":fal},{"id":67899,"name":"FS","only":gal}]}

我试过以下:

url = 'link'
r = session.get(url,headers=headers)


js = r.json()
user_id = js["lister"]['id']

print (user_id)

我收到错误:

    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

0 个答案:

没有答案