首页 > 代码库 > excel读取

excel读取

#coding=utf-8import  xlrdimport  osimport operatorfxls = ‘mobile.xlsx‘bp = xlrd.open_workbook(fxls)shxrange = range(bp.nsheets)try:    sh = bp.sheet_by_name(‘Sheet1‘)except:    print(‘error‘)#get linesnrows = sh.nrows#get colsncols = sh.ncolsprint("nrows %d,ncols %d" %(nrows, ncols))#get pos(1,1) datacell_value = http://www.mamicode.com/sh.cell_value(0,0)>