[Tutor] Using xml.etree ElementTree
Juan Christian
juan0christian at gmail.com
Tue Oct 7 21:08:33 CEST 2014
I have this XML scheme:
http://steamcommunity.com/profiles/76561198084537782?xml=1
My code:
self._xml = ElementTree.fromstring(requests.get(url + '?xml=1').content)
print(self._xml.tag) > returns > profile
It's working, the thing is that I don't know how to "navigate" inside the
XML, I read the doc but everything there regarding key-value is on
for-loops, I need something more direct, like:
XML.steamID64
XML.steamID
XML.onlineState
XML.vacBanned
...
Something like that, where I provide the key (<xmltag>) and get the value
(<xmltag>value</xmltag>). Is that possible?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141007/8d4e28e8/attachment-0001.html>
More information about the Tutor
mailing list