python读取excel表格上的值(eclipse+pydev)
import xlrd
class openExcel():
#读取Excel表
def rExcel(self,inFile):
rFile = xlrd.open_workbook(inFile)
#获取工作表
table = rFile.sheet_by_name('test')
#获取行数、列数
rowCounts = table.nrows - 1
colCounts = table.ncols
print(rowCounts)
#循环获取列表数据
for i in range(rowCounts):
print(table.row_values(i))
if __name__== '_main_':
t = openExcel()
t.rExcel('test.xls')