Python noob here. Wondering what's the cleanest and best way to remove all the "profile
" tags with updated
attribute value of true
.
I have tried the following code but it's throwing: SyntaxError("cannot use absolute path on element")
root.remove(root.findall("//Profile[@updated='true']"))
XML:
<parent>
<child type="First">
<profile updated="true">
<other> </other>
</profile>
</child>
<child type="Second">
<profile updated="true">
<other> </other>
</profile>
</child>
<child type="Third">
<profile>
<other> </other>
</profile>
</child>
</parent>