2016-11-09 96 views

回答

1

您可以嘗試迭代每一行並檢查單元格是否爲空。你可以用這個:

import xlrd 
book = xlrd.open_workbook('excel.xls') 
sheet = book.sheet_by_index(0) 

count = 0 
for row in range(sheet.nrows): 
    for col in sheet.row_values(row): 
     if col.strip() != '': 
      count += 1 
相關問題