added ex25

This commit is contained in:
Daniel Knüttel 2018-12-06 12:29:30 +01:00
parent 0461556e9f
commit 67ebc11121
2 changed files with 9 additions and 0 deletions

8
ex_25.py Normal file
View File

@ -0,0 +1,8 @@
from defusedxml import ElementTree
with open("python_class.xml") as fin:
for i, node in enumerate(ElementTree.parse(fin).iter()):
print(node.tag, ":", node.text)

1
python_class.xml Normal file
View File

@ -0,0 +1 @@
<python_class><teacher><name>Stefano</name><age>unknown</age></teacher><student><name>Jonathan</name><age>19</age><matr_number>2572463</matr_number></student><student><name>Susan</name><age>21</age><matr_number>4172463</matr_number></student><student><name>Dennis</name><age>22</age><matr_number>4176963</matr_number></student></python_class>