在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