python将数据输出到excel中

import xlsxwriter

workbook = xlsxwriter.Workbook('hello.xlsx') # 建立文件

worksheet = workbook.add_worksheet() # 建立sheet, 可以work.add_worksheet('employee')来指定sheet名,但中文名会报UnicodeDecodeErro的错误

worksheet.write('A1', 'Hello world') # 向A1写入

worksheet.write(1,1,'guoshun')#向第二行第二例写入guoshun
workbook.close()

转载于:https://www.cnblogs.com/shunguo/p/11399315.html

你可能感兴趣的:(python将数据输出到excel中)