python将99乘法表放入excel表格的方法
python中将99乘法表放入excel表格的方法
1、使用xwlt库创建workbook对象
workbook=xlwt.Workbook(encoding="utf-8")
2、创建工作表
workbook=xlwt.Workbook(encoding="utf-8")#创建workbook对象
worksheet=workbook.add_sheet('sheet1')#创建工作表
worksheet.write(0,0,'hello')#写入数据,第一个是行,第二个表示列,第三个参数内容
workbook.save('student.xls')
3、使用xwlt库把99乘法表放入excel表格
importxlwt
workbook=xlwt.Workbook(encoding="utf-8")#创建workbook对象
worksheet=workbook.add_sheet('sheet1')#创建工作表
foriinrange(0,9):
forjinrange(0,i+1):
worksheet.write(i,j,"%d*%d=%d"%(i+1,j+1,(i+1)*(j+1)))
workbook.save('99乘法表.xls')
以上就是python中将99乘法表放入excel表格的方法,希望能对大家有所帮助。更多Python学习教程请关注IT培训机构:千锋教育。

相关推荐HOT
更多>>
python中静态字符串的编码
python中静态字符串的编码1、静态字符串的编码方法取决于报头中的编码设置。在下面的代码中,变量名用UTF-8编码。#!/usr/bin/envpython#coding:...详情>>
2023-11-13 23:57:40
pythonpyg2plot的原理
pythonpyg2plot的原理1、说明PyG2Plot原理其实非常简单,其中借鉴了pyecharts的实现,但是因为蚂蚁金服的G2Plot完全基于可视分析理论的配置式结...详情>>
2023-11-13 21:25:26
python继承的特征有哪些?
python继承的特征有哪些?本文教程操作环境:windows7系统、Python3.9.1,DELLG3电脑。1、概念继承就是一个类可以获得另外一个类中的成员属性和...详情>>
2023-11-13 19:47:58
pythonFileNotFoundError的异常
python中FileNotFoundError的异常1、Python无法读取不存在的文件,因此它引发一个异常:Traceback(mostrecentcalllast):File"alice.py"...详情>>
2023-11-13 19:27:04热门推荐
技术干货






