Skip to main content
 首页 » 编程设计

python之重新排列节点 lxml 中的属性

2025年05月04日14mfrbuaa

<分区>

我有一个像

这样的元素节点
<Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Id="rId61" Target="media/image1.png"/> 

我需要按顺序对属性进行排序。输出应该看起来像

<Relationship Id="rId61" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="media/image1.png"/> 

我该如何重新排列它?目前我正在使用 lxml 库

谢谢