python xlrd excel读取操作

import xlrd


wb = xlrd.open_workbook("test.xlsx")

sheet1 = wb.sheets()[1]  # 通过索引顺序获取
#table = data.sheet_by_index(0)  # 通过索引顺序获取
#table = data.sheet_by_name(u'Sheet1')  # 通过名称获取

#table.row_values(i) # 获取整行和整列的值(数组)
#table.col_values(i)

nrows = sheet1.nrows
#ncols = table.ncols   获取行数和列数




#循环行列表数据
for i in range(nrows ):
    if i == 0:  # 0title过滤
        continue
    row = sheet1.row_values(i)
    print(row)
    #memNo = int(row[5])
    #print(str(memNo))

  

原文地址:https://www.cnblogs.com/oktokeep/p/13992393.html