标签:
python读取excel文件的链接都是从这里获取的:
http://blog.csdn.net/longshen747/article/details/17194259
http://www.cnblogs.com/yanzhi123/archive/2012/04/16/2452214.html
上个示例的代码:
import xml.etree.ElementTree as ET
import xlwt
import os
path = "D:/Cai_Bishe/xml/"
print path
wb = xlwt.Workbook()
for root, dirs, list in os.walk(path):
for l in list:
print l
dir = os.path.join(root, l)
wifiXml=ET.parse(dir)
wifiInfo=wifiXml.findall(‘./wifiInformation‘)
ws = wb.add_sheet(l)
i = 0
j = 0
for oneIter in wifiInfo:
for wifiList in oneIter.getchildren():
for wifi in wifiList.getchildren():
ws.write(i, j, wifi.tag)
j += 1
ws.write(i, j, wifi.text)
i += 1
j = 0
print wifi.tag, ‘:‘, wifi.text
print ‘############‘
wb.save(‘info.xls‘)
标签:
原文地址:http://www.cnblogs.com/hope100/p/4317238.html