#encoding:utf-8 from xml.dom import minidom import pandas as pd def readXML(xmlfilename): xmlDoc = minidom.parse(xmlfilename) items = xmlDoc.getElementsByTagName("wfs:member") NAME=[] LNG=[] LAT=[] FROM=[] for item in items: scenicName = item.getElementsByTagName("gml:name")[0] rowNAME = scenicName.firstChild.data NAME.append(rowNAME) # print "scenicname:" + scenicName.firstChild.data scenicLngLon = item.getElementsByTagName("gml:pos")[0] LNGLAT = scenicLngLon.firstChild.data # print LNGLAT strscenicLngLon=str(LNGLAT) # print strscenicLngLon strLngLon=strscenicLngLon.split(' ') # print strLngLon[0] rowLNG = float(strLngLon[0]) LNG.append(rowLNG) # print "lng:" +scenicLng.firstChild.data rowLAT = float(strLngLon[1]) L
利用python将xml转为csv
最新推荐文章于 2022-12-27 21:31:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)