当前第2页 返回上一页
根据Excel中sheet名称读取数据:
1 2 3 4 5 6 7 8 9 10 | import xlrd
def readExcelDataByName(fileName, sheetName):
table = None
errorMsg = None
try :
data = xlrd.open_workbook(fileName)
table = data.sheet_by_name(sheetName)
except Exception, msg:
errorMsg = msg
return table, errorMsg
|
根据Excel中sheet的序号获取:
1 2 3 4 5 6 7 8 9 10 | import xlrd
def readExcelDataByIndex(fileName, sheetIndex):
table = None
errorMsg = ""
try :
data = xlrd.open_workbook(fileName)
table = data.sheet_by_index(sheetIndex)
except Exception, msg:
errorMsg = msg
return table, errorMsg
|
更多Python相关技术文章,请访问Python教程栏目进行学习!
以上就是python怎么读取excel中的数值的详细内容,更多文章请关注木庄网络博客!!
返回前面的内容
相关阅读 >>
Python合法标识符要求是什么
Python中有栈吗
Python的int是什么
Python中选择排序的实例详解
Python如何连接mysql
Python字典中如何添加键值对
mac自带Python在哪
Python自定义对象实现切片功能的介绍(代码示例)
Python以什么划分句块
Python归一化多维数组的方法
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python怎么读取excel中的数值