从Google地图库导出JSON结果

2024-10-01 09:32:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我有下面的代码,它在Google地图上搜索一个地点列表,并生成一个JSON响应。 不过,我正在努力想办法把它放到CSV中。谢谢!你知道吗

import json
import googlemaps
import csv

gmaps = googlemaps.Client(key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')

params = {
    'query':"food",
    'location': "Rio de Janeiro, Brazil",          
    'radius': 90,
    'type':'resturant'
}

gplaces = gmaps.places(**params)

gplaces = gplaces = json.dumps(gplaces)

print(gplaces)

Tags: csv代码importjson列表google地图params