I got a XML-Doc with the following structure:
<defaults>
<options>
<param name="userMail">[email protected]</param>
<param name="adminMail"[email protected]</param>
<param name="language">en</param>
<param name="country">EN</param>
<> ... </>
</defaults>
</options>
Inside the "options"-Tag I got a lot of param-Elements, I want to search for the "userMail" and "adminMail" element.
tree = ET.parse("file_config.xml")
root = tree.getroot()
for admin in root.iter("param"):
print(admin.text)
This works great, but I get the whole output ([email protected], admin@mailorg, en, EN).
How can I search only for the "userMail" and "adminMail" element and store each in a single variable?
I use xml.etree.ElementTree as ET.
See below (do the same for the user mail)
output