怎样优雅解决 python xpath 解析xml解析 xml gb2312 编码的问题

python 解析xml(解决gb2312编码有关问题)_读书人
python 解析xml(解决gb2312编码有关问题)
&来源:读书人网&【读书人网():综合教育门户网站】
python 解析xml(解决gb2312编码问题)import urllibimport xml.dom.minidomurl http://223.202.45.187:8
python 解析xml(解决gb2312编码问题) import urllibimport xml.dom.minidom
url = 'http://223.202.45.187:8080/BillQueryService3/pub/query/billing/LogBandWidthByChannelID?Type=standard&RegionID=9050&ChannelCount=1&StartTime=&EndTime=&ChannelID1=46056'if __name__ == '__main__':
response = urllib.urlopen(url).read()
doc = xml.dom.minidom.parseString(response.replace("GB2312","utf-8"))
doc.documentElement
nodeList=root.getElementsByTagName("InData")
node=nodeList.item(0);
print node.childNodes[0].nodeValue&BandWidthDatas&&InData&582,435,629,297,281,747,466,232,646,894,218,785,298,570,606,197,373,981,320,045,113,219,253,598,956,070,348,133,,,592,422,452,387,229,246,733,735,,117,637,271,784,846,049,607,329,645,384,754,,,,,,,,,,,,,,,,,,,,,,,,329,,,,,,,,,,,,,,,,210,,,840,079,,097,157,517,213,569,,,,,,,,,427,464,,214,648,723,739,218,395,534,081,693,423,572,644,008,997,731,696,704,684,544,529,781,204,732,675,087,041,831,399,134,855,960,039,867,264,472,113,322,154,995,129,510,045,740,249,092,766,197,121,202,273,450,861,682,366,355,157,761,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,924,,390,953,473,497,833,,494,623,,955,697,,486,,593,681,323,&/InData&&/BandWidthDatas&

我要回帖

更多关于 python dom解析xml 的文章

 

随机推荐