写Excel

import xlrd(读) ,xlwt(写),xultils(修改数据)

写Excel
import xlwt
book = xlwt.Workbook()
sheet = book.add_sheet('sheet')
sheet.write(0,0,'学生姓名')
book.save("student.xls")#wps结尾用xls,用别的会打不开

 修改

from xultils import copy

book = xlrd.open_workbook('xxx.xls')

new = new_book.get_sheet(0)

sheet.write(0,0'x')

new_book.save('xxx.xls')

 

上一篇:python--xlrd/xlwt/xlutils


下一篇:xlwt 模块_python