-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmlreader.py
31 lines (31 loc) · 1.15 KB
/
xmlreader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import xml.etree.ElementTree as ET
import os
tree = ET.parse('Yo_Robot_e.xml')
root = tree.getroot()
print('---')
try:
for child in root:
#print(child.tag, child.attrib)
for e in child:
#print(e.tag, ":", e.attrib)
for i in e:
#print(i.tag, ":", i.attrib)
for a in i:
#print(a.tag, ":", a.attrib)
for t in a:
#print('* ', t.tag, ":", t.attrib)
for u in t:
#print('** ', u.tag, ":", u.attrib)
for o in u:
print('*** ', o.tag, ":", o.attrib)
for x in o:
#print('**** ', x.tag, ":", x.attrib)
for y in x:
# print('***** ', y.tag, ":", y.attrib)
for z in y:
print('****** ', z.tag, ":", z.attrib)
print('---')
except:
print('error jeje')
print ('***')
type(root)