原理图
1.安装xlwt模块
2.代码如下
import xlwt
myexcel = xlwt.Workbook(encoding = 'utf-8') # 创建myexcel对象
excelsheet = myexcel.add_sheet('sheet1') # 创建工作表
excelsheet.write(0,0,'helloworld') # 写入数据helloworld,0和0 表示第一行和第一列
myexcel.save('我的excel.xls') # 保存数据到我的excel.xls中