Sample of reading XML file with python
Sample of reading XML file with python
import xml.etree.ElementTree as ET
# Load the XML file
tree = ET.parse('data.xml')
root = tree.getroot()
# Iterate through 'person' elements and extract data
for person in root.findall('person'):
name = person.find('name').text
age = person.find('age').text
print(f"Name: {name}, Age: {age}")
コメント
コメントを投稿