直接上代码:
import xlsxwriter #导入模块
import numpy as np
import json
workbook = xlsxwriter.Workbook('new_excel.xlsx') #新建excel表
worksheet = workbook.add_worksheet('sheet1') #新建sheet(sheet的名称"sheet1")
data = np.ones((100,200),np.uint8)#这里可以换成你想存储的数据
shape = np.shape(data)
for indexrow in range(shape[0]):
print(indexrow)
rowdata = json.loads(str(data[indexrow,:].tolist()))
head = 'A'+str(indexrow+1)
worksheet.write_row(head,rowdata)
workbook.close()