📜  xml.parsers.expat.expaterror: not well-formed (invalid token): line 1, column 0 - 不管代码示例

📅  最后修改于: 2022-03-11 15:00:47.603000             🧑  作者: Mango

代码示例1
import xml.etree.ElementTree as ET
import xmltodict
import json


tree = ET.parse('your_data.xml')
xml_data = tree.getroot()
#here you can change the encoding type to be able to set it to the one you need
xmlstr = ET.tostring(xml_data, encoding='utf-8', method='xml')

data_dict = dict(xmltodict.parse(xmlstr))