标签:复制 get family pen imp ali copy span pre
import xlrd
from xlutils import copy
# 先用xlrd模块,打开一个excel
book=xlrd.open_workbook(‘app_student.xls‘)
# 通过xlutils这个模块里面的copy方法,复制一份excek
new_book=copy.copy(book)
sheet=new_book.get_sheet(0) #获取sheet页
# sheet.write(0,0,‘编号‘)
# sheet.write(0,1,‘名字‘)
lis = [‘编号‘,‘名字‘,‘性别‘,‘年龄‘,‘地址‘,‘班级‘,‘手机号‘,‘金币‘]
for col, filed in enumerate(lis):
sheet.write(0, col, filed)
new_book.save(‘app_student.xls‘)
标签:复制 get family pen imp ali copy span pre
原文地址:https://www.cnblogs.com/jiadan/p/9026984.html