python xml.etree.ElementTree get multi labels

Viewed 11

I am trying to use xml.etree.ElementTree to parse a xml file, find multi label to one tag, My xml

<attributes>color=red, rotation=0.0</attributes>
<hasparts>0,1,2</hasparts>

i use the code is not i wanted.

ET.SubElement(obj, "attributes").text = "color=red"
ET.SubElement(obj, "attributes").text= "rotation=0.0"
for i in range(2):
    ET.SubElement(parts, "hasparts").text = str(i)

how to get multi labels in one tag.

0 Answers
Related