当前第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中的数值的详细内容,更多文章请关注木庄网络博客!!
返回前面的内容
相关阅读 >>
anaconda和Python区别
Python的关键字有哪些
Python输出hello world代码的方法
java与Python中单例模式的区别
Python os.chown() 方法是什么?它有什么样的作用?
深入了解Python之xml操作
Python判断变量的类型吗
Python中pip是什么
Python做并行计算可以吗
Python中关于executemany以及序列的实例详解
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python怎么读取excel中的数值