标签:port 符号 不能 read json pen with open amp pytho
<suite> <case id="Demo.TestCase.001"> <name>DemoTestCase001</name> <path>testCase/demo/</path> </case> <case id="Demo.TestCase.002"> <name>DemoTestCase002</name> <path>testCase/demo/</path> </case> </suite>
import xmltodict import json with open(‘setInfo.xml‘, ‘r‘) as f: str_xml = str(f.read()) print(str_xml) str_xml = str_xml.replace(‘&‘, ‘&‘) # xml格式不能有"&"符号 doc = json.dumps(xmltodict.parse(str_xml)) print(doc) dic = json.loads(doc) print(dic)
标签:port 符号 不能 read json pen with open amp pytho
原文地址:https://www.cnblogs.com/yunsongfu/p/13362480.html