replacing xml elements with other elements using lxml

Ultrus owntheweb at gmail.com
Wed Aug 29 21:46:11 EDT 2007


Ah! I figured it out. I forgot that the tree is treated like a list.
The solution was to replace the <random> element with the first <item>
child, then use Python's insert(i,x) function to insert elements after
the first one.

lxml rocks!




More information about the Python-list mailing list