The from XML. Etree import ElementTree as ET
Tree=ET. Parse (r 'C: \ Users \ liuch \ Downloads \ data - text. XML')
Root=tree. Getroot ()
Data=https://bbs.csdn.net/topics/root.find (' data ')
All_data []=https://bbs.csdn.net/topics/
# lookup_key=range (2 * * 100)
For observation data in:
Record={}
For the item in observation:
Lookup_key=list (item. Attrib. Keys ()) [0]
If lookup_key=='Numeric:
Rec_key='NUMERIC'
Rec_value=[' Numeric]
https://bbs.csdn.net/topics/item.attribThe else:
Rec_key=item. Attrib [lookup_key]
Rec_value=[' Code ']
https://bbs.csdn.net/topics/item.attrib
Record [rec_key]=rec_value
All_data. Append (record)
Print (all_data)
CodePudding user response:
You need the complete error message posted to see it