Guys help please! There is a certain xml file:

<SwiftTest><Data type="BinaryCustomStatisticsDocument" version="1" Type="Line"> <Series StatString="load.scenarios.attempts" AutoColorCode="False" Axis="Count" Color="4278190335" DefaultIsVisible="True" DefaultShowLabels="False" DefaultShowPoints="False"> <Flag Name="Load">0x0001</Flag> <Flag Name="Total/Per Second">0x0001</Flag></Series>

That's the problem. I need to extract only Total / Per Second from the tag. Unfortunately, I could only extract by this method:

for v in tree.iter(tag='Flag'): values = v.attrib['Name']

And he extracts like this:

Load Total/Per Second

I use xml.etree.ElementTree

  • Well, with what magic do you want a particular tag to return? You have a list of keys, and you get a list of keys ... - Andrio Skur
  • tree.find("Flag[@Name='Total/Per Second']") - godva
  • Many thanks! Works. - Andrey Sindeev

0