召集一个班级

2024-04-30 00:38:08 发布

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

我正在使用geopy,有一个关于为什么会出现错误的问题。在

此代码示例来自github提供的示例。如前所述

from geopy.geocoders import Nominatim

geolocator = Nominatim()

location = geo.geocode("NY")

print((location.latitude, location.longitude))

为什么下面的代码提供了一个错误?背后的原因是什么?在

^{pr2}$

第二个代码提供的错误是:

Traceback (most recent call last):
  File "C:/Users/Leb/Desktop/Python/so2.py", line 5, in <module>
    location = geo.geocode("NY")
TypeError: geocode() missing 1 required positional argument: 'query'

Tags: 代码fromimportgithub示例错误locationgeo