首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Zomato API数据键中获取值

从Zomato API数据键中获取值
EN

Stack Overflow用户
提问于 2017-03-22 17:13:19
回答 1查看 973关注 0票数 1

目前,我正试图从佐马托API中的"best_restaurant“列表中获取唐熙华餐厅的名称和地址。

我试过了

代码语言:javascript
复制
response = requests.get(url, headers=header)

data = (response.json())

# print(data)

for item in data["best_rated_restaurant"]:
    print item["name"]

我正在接收"best_rated_restaurant“的数据,但不知道如何在数据中获取特定的值。

有没有人知道我会如何检索数据中的信息,如姓名、地址、菜肴等?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-22 17:24:24

你就快到了

代码语言:javascript
复制
for item in data["best_rated_restaurant"]:
    print item['restaurant']['name']
    print item['restaurant']['location']['address']
    print item['restaurant']['cuisines']
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42958415

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档