直接上代码 1 import json 2 import xmltodict 3 4 def xmlToJson(xml_str): 5 '''传入xml字符串,返回字典''' 6 dic = xmltodict.parse(xml_str, encoding='utf-8') 7 dic = json.dumps(dic, indent=4) 8 return dic 来源:https://www.cnblogs.com/carlvine/p/11713531.html 标签 xml转json xml语言