Python 保存矩阵为Excel的实现方法
时间:2021-03-10 09:24:43|栏目:Python代码|点击: 次
如下所示:
def save(data, path):
f = xlwt.Workbook() # 创建工作簿
sheet1 = f.add_sheet(u'sheet1', cell_overwrite_ok=True) # 创建sheet
[h, l] = data.shape # h为行数,l为列数
for i in range(h):
for j in range(l):
sheet1.write(i, j, data[i, j])
f.save(path)
代码简单,但是常用!
栏 目:Python代码
本文地址:http://www.codeinn.net/misctech/77793.html






