This is a piece of code that extracts google place id for a location from a json.
(这是一段代码,可从json提取位置的Google地方ID。)
But I'm not getting the expected/actual place id of the location. (但是我没有得到该位置的预期/实际位置ID。)
import urllib
import json
serviceurl = 'http://python-data.dr-chuck.net/geojson?'
address = input('Enter location: ')
parms = {'sensor': 'false', 'address': address}
url = serviceurl + urllib.parse.urlencode(parms)
print('Retrieving: ', url)
data = urllib.request.urlopen(url).read()
print('Retrived',len(data),'characters')
jsondata = json.loads(data)
place_id = jsondata['results'][0]['place_id']
print('Place id: ', place_id)
Input: South Federal University
(输入:南联邦大学)
Result/place_id: ChIJJ8oO7_B_bIcR2AlhC8nKlok
(结果/ place_id:ChIJJ8oO7_B_bIcR2AlhC8nKlok)
Actual/expected place_id: ChIJNeHD4p-540AR2Q0_ZjwmKJ8
(实际/预期的place_id:ChIJNeHD4p-540AR2Q0_ZjwmKJ8)
ask by Vishal Pallikonda translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…