For the following XML file, I'm trying to get all the book titles and append it to a list.
XML file-
<?xml version="1.0" encoding="UTF-8"?>
<Text>
<Library>
<Book>
<Title>XYZ</Title>
</Book>
<Book>
<Title>ABC</Title>
</Book>
</Library>
</Text>
I'm using ElementTree to extract the tag values using this code-
for child in root.iter('Text'):
t1=(child.find('Library/Book/Title').text)
t2=(child.find('Library/Book/Title').text)
print (t1,t2)
I'm unable to get the second tag value. Is it possible to get both the values in one find and append it to a list?