我正在尝试使用python从api读取数据。所以我的问题是:1)使用此代码,我试图在列表中打印3个字典中1个的内容。
response = requests.get(url, params=payload)
data = response.json()
log = json.dumps(data['result'], indent = 1)
print log
到目前为止,一切都很好,它正在打印我:
[
{
"line": "[email protected]:birthdaydate"
},
{
"line": "[email protected]:birthdaydate"
},
{
"line": "[email protected]:birthdaydate"
},
]
我的问题是:有没有办法让输出看起来像
"[email protected]:birthdaydate"
"[email protected]:birthdaydate"
"[email protected]:birthdaydate"
抱歉,我是完全不熟悉python的菜鸟
提前谢谢您
尝试这个:
response = requests.get(url, params=payload)
data = response.json()
log = data['result']
for l in log:
print(l["line"])