from xml.etree import ElementTree as ET
import os
#新文件路径与旧文件路径
NewFilePath = "D:\parseXml\\00001_00003_00000.xml"#新文件路径
OldFilePath = "D:\parsexml1\\00001_00001_00000.xml"#旧文件路径
#获取指定磁盘下的xml文件列表#1
def getXmlFiledir(FindPath):
suffix='.xml'#文件后缀
FileList = []
FileNames = os.listdir(FindPath)
for filename in FileNames:
name, suf = os.path.splitext(filename) # =>文件名,文件后缀
if suf == suffix:
FileList.append(os.path.join(FindPath,
循环比较多个可比较,两个xml文件是否相同
![](https://img-home.csdnimg.cn/images/20240711042549.png)