【发布时间】:2018-01-19 02:27:36
【问题描述】:
我有一个 xml 标签,我在 python 中使用下面的代码来读取这个标签,但我只想在 type = "Actual" 时获取数据,否则忽略。目前我得到了他们每个人的价值,即 40,50,60。
xml 标签:
<student type="Actual">40</student>
<student type="estimated">50</student>
<student>60</student>
Python 代码:
student = root.find("./student")
请您告知此语法所需的更改。
【问题讨论】:
-
student = root.find("./student>应该是 Python 还是 XML? -
这是一个python代码
标签: python xml elementtree