On Tue, Oct 7, 2014 at 4:08 PM, Juan Christian <juan0christ...@gmail.com>
wrote:

> 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?
>


So.. I found that I can do it with 'self._xml[index].text', but that's not
a good and 'visible' way to do things. Explicit is better than implicit,
and this XML has some data that might or might not be there, so I can't
trust in the index.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to