在python中使用xlrd模块对excel表格进行遍历,具体方法如下:
import xlrd #导入xlrd模块
bok = xlrd.open_workbook(r'E:\temp\xxxx.xlsx') #excel表格路径
sht = bok.sheets()[0]
row =sht.nrows
for i in range(row):
rowdate = sht.row_values(i)#i行的list
for a,b in enumerate(rowdate):
print(i,a,b) #第i行,a列,数据b