i have a question. How can i create list of a list from xml dataset in ElemenTree python? for example i have this dataset :
<data>
<article>
<author> Tony </author>
</article>
<article>
<author> Andy </author>
<author> John </author>
</article>
<article>
<author> Paul </author>
<author> leon </author>
</article>
</data>
There is a specific function like :
tree = ET.parse('data.xml')
root = tree.getroot()
for author in root.iter('author'):
print(author.text, author.attrib['pid'])
that would find and show all author in dataset in single list [Tony, Andy, John, Paul, Leon]. How can i improve those code above so i can get result author in list of s list [[Tony], [Andy, John], [Paul, Leon]]? Maybe theres is a specific function to perform this?