直接上代碼
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
直接上代碼
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
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。