您好,我在 python 中使用 pyspeech 和 googlemaps 来获取方向,我试图让 pyspeech 大声说出方向,也就是说代码中的“< b >”的大于、小于和 b 就在那里一种忽略这些括号并只说其余部分或方向的方法?
代码:
from googlemaps import GoogleMaps
import speech
api_key = (my key)
gmaps = GoogleMaps(api_key)
place1 = raw_input("Your address: ")
place = raw_input("Destination: ")
start = place1
end = place
dirs = gmaps.directions(start, end)
time = dirs['Directions']['Duration']['seconds']
dist = dirs['Directions']['Distance']['meters']
route = dirs['Directions']['Routes'][0]
for step in route['Steps']:
print step['descriptionHtml']
speech.say(step['descriptionHtml'])