For this xml
http://dev.virtualearth.net/REST/v1/Locations?q=St%20Mard,%20FR&o=xml&key={BingMapsKey}
I'm trying to print the Name for each Location
import requests
import xml.etree.ElementTree as ET
url = 'http://dev.virtualearth.net/REST/v1/Locations?q=St%20Mard,%20FR&o=xml&key={BingMapsKey}'
response = requests.get(url)
with open('loc.xml', 'wb') as file:
file.write(response.content)
mytree = ET.parse('/Users/xxxxxxx/Desktop/pscripts/loc.xml')
name = mytree.findall('Name')
for n in name:
n = name.text
print (n)