主页
Python
Python xml 模块
demo_ref_module_xml_basic
运行 ❯
×
更改方向
保存代码
更改主题
import xml.etree.ElementTree as ET xml_data = '
Tobias
25
' root = ET.fromstring(xml_data) print(f'Name: {root.find("name").text}') print(f'Age: {root.find("age").text}')
Name: Tobias
Age: 25