【发布时间】:2016-06-08 13:12:48
【问题描述】:
这是我的代码:
from googlemaps import Client as GoogleMaps
mapServices = GoogleMaps('')
start = 'texarkana'
end = 'atlanta'
direction = mapServices.directions(start, end)
for step in direction['Direction']['Routes'][0]['Steps']:
print(step['descriptionHtml'])
我收到以下错误:
File "C:\Python27\directions.py", line 7, in <module>
for step in direction['Direction']['Routes'][0]['Steps']:
TypeError: list indices must be integers, not str
【问题讨论】:
-
那么您认为这里有什么问题?
-
我不知道为什么会出现错误