我从这个网站https://api.projectnimbus.org/neaodataservice.svc/NowcastSet使用 beautifulsoup 提取了这段代码?
显示所有位置后,如何将其漂亮地打印到密钥对值?喜欢的位置:宏茂桥纬度:1.3546846 经度:103.564132?
from BeautifulSoup import BeautifulStoneSoup #Using bs3
import urllib2
url="https://api.projectnimbus.org/neaodataservice.svc/NowcastSet"
request = urllib2.Request(url)
request.add_header("accept", "*/*")
request.add_header('AccountKey', "OSJeROQjTg4v7Ec3kiecjw==")
request.add_header('UniqueUserID', "00000000000000000000000000000001")
result = urllib2.urlopen(request)
xml_str = result.read()
soup = BeautifulStoneSoup(xml_str)
prop_list = []
for content in soup.findAll("m:properties"):
props = {}
for prop in content.findChildren():
props[prop.name[2:]] = prop.text
prop_list.append(props)
print prop_list