写一段python代码,替换xml标注文件的标注名称
时间: 2023-02-20 12:57:44 浏览: 78
python 的xml标记
import xml.etree.ElementTree as ET
tree = ET.parse('filename.xml')
root = tree.getroot()
for element in root.iter('tag'):
element.set('name', 'new_name')
tree.write('filename.xml')
阅读全文