小编use*_*096的帖子

使用 ElementTree (Python) 向嵌套结构添加父标签

I have the following structure

<root>
  <data>
     <config>
        CONFIGURATION
     <config>
  </data>

</root>
Run Code Online (Sandbox Code Playgroud)

使用 Python 的 ElementTree 模块,我想添加一个父元素来<config>标记为

<root>
  <data>
    <type>
      <config>
        CONFIGURATION
      <config>
    </type>
  </data>

</root>
Run Code Online (Sandbox Code Playgroud)

此外,xml 文件可能在其他地方有其他配置标签,但我只对出现在数据标签下的那些感兴趣。

python xml elementtree

0
推荐指数
1
解决办法
1291
查看次数

标签 统计

elementtree ×1

python ×1

xml ×1