This forum is now read-only. Please use our new forums at

How to use APIs with Python Forum

View Course » View Exercise

423 points
Submitted by
about 3 years ago

Get value of multiple tags?

Sorry if my question is vague, I don't really know how to word it. Anyway, in the "Parsing XML" section, I understand (sort of) how we obtain the names from the xml file. How would we go about getting both the species and the names in the same loop?

For example, in that exercise, we have the XML file as follows:

To get both, instead of getting the elements by tag name "name", would we get the elements by tag name "pet"? How then would we obtain the values in the "name" and "species" tags?