import xlwt # 负责写excel
import xlrd
filename =xlwt.Workbook() #创建工作簿
sheet1 = filename.add_sheet(u'sheet1',cell_overwrite_ok=True) #创建sheet
[h,l]=your_array.shape #h为行数,l为列数
for i in range (h):
for j in range (l):
sheet1.write(i,j,your_array[i,j])
filename.save('name_of_your_excel_file.xls')
Python 将矩阵保存为excel文件
最新推荐文章于 2024-07-01 02:33:58 发布