import os
import xml.etree.ElementTree as ET
# Directory containing the XML filesxml_dir = 'path/to/xml/files'# Loop through each file in the directoryfor filename in os.listdir(xml_dir):
if filename.endswith('.xml'):
file_path = os.path.join(xml_dir, filename)
# Parse the XML file tree = ET.parse(file_path)
root = tree.getroot()
# Access the XML data as needed# Here you can access elements, attributes, text, etc.for elem in root.iter():
print(elem.tag, elem.text)