问题描述
我设置了 lat1
和 lng1
。当我尝试时:
location = geolocator.reverse('lat1','lng1')
它给了我错误:
类型错误
Traceback (most recent call last)
<ipython-input-65-bef81ce5884b> in <module>
----> 1 location = geolocator.reverse('lat1','lng1')
TypeError: reverse() takes 2 positional arguments but 3 were given
解决方法
您可以使用以下代码:
location = geolocator.reverse("{},{}".format(lat1,lng1))
上面的代码将变量格式化为 .reverse()
方法的字符串。