Question: *Get specific attribute values for XML in python* I was trying to get all points attribute values from TextRegion--> Coords tag. I keep getting errors

*Get specific attribute values for XML in python*

I was trying to get all "points" attribute values from "TextRegion--> Coords" tag. I keep getting errors from it. There are tags called "TextRegion" and "ImageRegion" which both contain "Coords". However, I only want the Coords points from "TextRegion".

Please help! Thank you!!

Here is my Sample.xml file:

   2021-01-24T17:11:35 1969-12-31T19:00:00                     

Here is my code so far:

import xml.etree.ElementTree as ET tree = ET.parse('Sample.xml') root = tree.getroot() print([el.attrib.get('points') for el in tree.findall('.//Coords')])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!