如标题所示,我使用加速器来操作excel文件。
代码:
from pyExcelerator import parse_xls
fpath='D:\\Capacity_20120811.xls'
eData=parse_xls(fpath)
>>> eData
[(u'testExcelReport_hr',
{(0, 0): u'Deletetime',
(0, 1): u'Food',
(0, 2): u'Peak Rate',
(0, 3): u'Total Bytes',
(0, 4): u'Total Msg No',
(1, 0): u'20110824T05',
(1, 1): u'111BSA',
(1, 2): 6255326.0,
(1, 3): 16226057.0,
(1, 4): 127.0,
(2, 0): u'20110824T06',
(2, 1): u'111BSA',
(2, 2): 352978.0,
(2, 3): 672104.0,
(2, 4): 2124.0})]我要sheetname:'testExcelReport_hr'删除工作表
发布于 2012-08-13 02:52:05
你可以用一个列表来理解它:
eData = [(sheet_name, sheet_data) for (sheet_name, sheet_data) in eData
if sheet_name != u'testExcelReport_hr']这将保留所有工作表,但名为testExcelReport_hr的工作表除外,这实际上是删除该工作表。
https://stackoverflow.com/questions/11927582
复制相似问题