import xlwt
workbook = xlwt.Workbook(encoding=“utf-8”) #创建workbook对象
worksheet = workbook.add_sheet(‘sheet1’) #创建工作表
for i in range(9):
for j in range (i+1):
worksheet.write(i,j,str(i+1)+‘x’+str(j+1)+’=’+str((i+1)*(j+1))) #写入数据,第一行参数’行’ 第二个参数’列’ 第三个参数 内容
workbook.save(‘student.xls’)
04-12
591
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-11
4200
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-03
748
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)