How to clone Element objects in Python xml.etree? I\'m trying to procedurally move and copy (then modify their attributes) nodes.
Element
xml.etree
If you have a handle on the Element elem's parent you can call
elem
parent
new_element = SubElement(parent, elem.tag, elem.attrib)
Otherwise you might want to try
new_element = makeelement(elem.tag, elem.attrib)
but this is not advised.