python操作excel

一.安装模块

pip install xlwt

二.往excel写数据

#创建excel

excel=xlwt.Workbook()

#添加一个sheet页

sheet=excel.add_sheet('胖妞儿')

#往行和列写入内容

sheet.write(0,0,'姓名')

sheet.write(0,1,'性别')

excel.save('students.xls')

posted @ 2019-05-10 15:03  胖妞儿  阅读(170)  评论(0编辑  收藏  举报