import xlwt
def getExel(mylist):
#表头的标题
header = ['','','']
book = xlwt.Workbook(encoding='utf-8')
sheet = book.add_sheet('Sheet1')
for k in range(len(header)):
sheet.write(0,k,header[k])
i = 1#注意要从1开始,上面那一行标题已经占了一行
for list in mylist:#一个二重循环
j = 0
for data in list:
sheet.write(i,j,data)
j += 1
i += 1
book.save('D:/test.xls')
将二维列表写进Exel套路
最新推荐文章于 2022-05-19 15:29:44 发布