I am trying to read the filename of an image from the XML file I run the following code:
import xml.etree.ElementTree as ET
tree = ET.parse(r'...\57128.xml')
root = tree.getroot()
a = root.find('.//filename')
print(a)
But instead of 57128.png I get this output: <Element 'filename' at 0x000001ED3297C4A8>
This is what the xml file contains:
<annotation>
<folder>save</folder>
<filename>57128.png</filename>
<size>
<width>1280</width>
<height>720</height>
<depth>3</depth>
</size>
What else can I do to get the filename as it is written in the XML file?