-3

Python用のPython Googleマップがあります。私はこのコードを持っています:

from googlemaps import GoogleMaps
place1 = raw_input("your address: ")
place = raw_input("Destination: ")
gmaps = GoogleMaps(api_key)
directions = gmaps.direction(place1, place)
for step in directions['Directions']['Routes']['seconds'][0]['Steps']:
     print step['descriptionHtml']

そして、私はこのエラーが発生します

    Traceback (most recent call last):
  File "C:\Python27\test.py", line 152, in <module>
    directions = gmaps.direction(place1, place)
AttributeError: 'GoogleMaps' object has no attribute 'direction'

ユーザーに住所と目的地を尋ねて、道順を見つけようとしています。

4

2 に答える 2

1

メソッドは実際には のように見えますGoogleMaps.directions(origin, destination, **kwargs)。メソッド名の「s」に注目してください。API ドキュメントへのリンクは次のとおりです。

于 2013-06-10T19:55:46.977 に答える