Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
424 views
in Technique[技术] by (71.8m points)

json - 我写了一些代码以提取json中给定位置的Google地方ID,但得到了另一个地方ID(I wrote some code to extract google place id for a given location within a json, but getting a different place id)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...