2025-09-10:仓库迁移

This commit is contained in:
2025-09-10 16:12:45 +08:00
parent e0e49b0ac9
commit 3130e336a1
146 changed files with 4066 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
from xml.etree.ElementTree import parse, Element
if __name__ == '__main__':
doc = parse(r'6.数据编码与处理/6.test.xml')
# 得到XML的root
root = doc.getroot()
print(root)
# 从root里移除一些从root里找到的节点
root.remove(root.find('sri'))
root.remove(root.find('cr'))
# 得到某个具体节点的下标
print(root.getchildren().index(root.find('nm')))
# 创建一个节点,并在根节点下插入
e = Element('spam')
e.text = 'This is a test'
root.insert(2, e)
# 保存为XML文件
doc.write(r'6.数据编码与处理/6.test_result.xml', xml_declaration=True)