Python 3.x 找到离给定位置最近的特定位置

Python 3.x 找到离给定位置最近的特定位置,python-3.x,google-api,google-places-api,Python 3.x,Google Api,Google Places Api,我想找到一个地方最近的具体位置,比如离给定位置最近的医院或警察局等。我在其中一个问题中看到了这段代码,但我没有得到对此代码的任何回应 from googleplaces import GooglePlaces, types, lang google_places = GooglePlaces(API KEY) query_result = google_places.nearby_search( location='London, England', radi

我想找到一个地方最近的具体位置,比如离给定位置最近的医院或警察局等。我在其中一个问题中看到了这段代码,但我没有得到对此代码的任何回应

from googleplaces import GooglePlaces, types, lang

google_places = GooglePlaces(API KEY)

query_result = google_places.nearby_search(
        location='London, England',
        radius=20000, types=[types.TYPE_FOOD])

print (query_result.html_attributions)
我想要一个工作代码,帮助我找到这些最近的社区地方,如警察局,银行,医院到指定的位置。
谢谢

这个代码对我很有用

from googleplaces import GooglePlaces, types, lang

google_places = GooglePlaces("AIzaSyCNLxPxFmG3kfrALBUkRFb_R5UdemVnqqQ")

query_result = google_places.nearby_search(
        location="51.529972 -0.127676",
        radius=20000, types=[types.TYPE_RESTAURANT])

#if query_result.has_attributions:
print (query_result.places)

运行代码时会发生什么?你有错误吗?请注意,从文档()中可以看出,您只能按一种特定类型限制搜索结果,最多只能得到60个左右的结果。很抱歉,答复太晚。我根本没有得到任何输出。我只得到“[]”作为输出。