etree Clone Node

后端 未结 5 1230
慢半拍i
慢半拍i 2020-12-30 20:00

How to clone Element objects in Python xml.etree? I\'m trying to procedurally move and copy (then modify their attributes) nodes.

5条回答
  •  無奈伤痛
    2020-12-30 20:31

    You can just use copy.deepcopy() to make a copy of the element. (this will also work with lxml by the way).

提交回复
热议问题