Iam是python & API搜索的新手。我在阅读python中的yelp响应时遇到了问题。任何帮助都会很好。谢谢。
> params = {
> 'term': 'lunch,pancakes' }
> response=client.search('Los Angeles',**params) 这是输出:
<yelp.obj.search_response.SearchResponse object at 0x138ad7a58>发布于 2016-09-10 11:14:05
SearchResponse包含与术语1相匹配的businesses列表。
试试这个:
for business in response['businesses']:
print(business['name'])发布于 2017-03-20 13:24:36
您可能需要执行JSON转换以使其可订阅。
import json
json_response = json.loads(response)
for business in json_response['businesses']:
print(business['name'])https://stackoverflow.com/questions/39424127
复制相似问题