Skip to content Skip to sidebar Skip to footer

How Do I Access Text Between Tags With Xml.etree.elementtree

I am trying to extract the text value between two tags of an XML document with xml.etree.ElementTree. In the following example, that would be the values text two and text three. I

Solution 1:

Use itertext:

>>> z
<Element 'c' at 0x1030697d0>
>>> for i in z.itertext():
...   print(i)
...
text one
ttt
text two
uuu
text three

Post a Comment for "How Do I Access Text Between Tags With Xml.etree.elementtree"