python怎么將矩陣每行的和保存到數組?
from xlrd import open_workbook wb=open_workbook(r'd:/222.xlsx') tb=wb.sheets()[0] data=[] for r in range(tb.nrows): val=[] for c in range(tb.ncols): val.append(tb.cell_value(r,c)) data.append(tuple(val)) print(data)
python怎么將矩陣每行的和保存到數組?
from xlrd import open_workbook wb=open_workbook(r'd:/222.xlsx') tb=wb.sheets()[0] data=[] for r in range(tb.nrows): val=[] for c in range(tb.ncols): val.append(tb.cell_value(r,c)) data.append(tuple(val)) print(data)