麻煩大神給看一下, 怎么能改?
from xml.etree import ElementTree as ET
tree = ET.parse(r'C:\Users\liuch\Downloads\data-text.xml')
root = tree.getroot()
data = root.find('Data')
all_data = []
# lookup_key = range(2**100)
for observation in data:
record = {}
for item in observation:
lookup_key = list(item.attrib.keys())[0]
if lookup_key == 'Numeric':
rec_key = 'NUMERIC'
rec_value = item.attrib['Numeric']
else:
rec_key = item.attrib[lookup_key]
rec_value = item.attrib['Code']
record[rec_key] = rec_value
all_data.append(record)
print(all_data)
uj5u.com熱心網友回復:
你這個需要反完整的錯誤資訊貼出來看一下轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/11074.html
標籤:新手樂園
上一篇:編譯libcaffe時,生成cudnn_conv_layer.cpp后顯示未宣告的識別符號,求各位大佬幫幫忙
下一篇:跪求 急需!!!! 大一c語言
