Python学习笔记十四_操作Excel

操作Excel

1、安装xlrd、xlwt第三方模块

2、写Excel

import xlwt
book = xlwt.Workbook()#新建一个excel
sheet = book.add_sheet('学生信息')#加sheet页
sheet.write(0,0,'姓名')#行、列、写入的内容
sheet.write(0,1,'年龄')
sheet.write(0,2,'性别')
book.save('stu.xls')#结尾一定要用.xls

3、读Excel

猜你喜欢

转载自www.cnblogs.com/dongrui624/p/8986641.html