码迷,mamicode.com
首页 > 编程语言 > 详细

python 读取 excel文件

时间:2015-03-06 10:01:19      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

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‘)

python 读取 excel文件

标签:

原文地址:http://www.cnblogs.com/hope100/p/4317238.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!