3、Python文件操作工具 xlsxwriter 工具,文件比较工具,# _*_ enco


# _*_ encoding:utf-8 _*_

import xlsxwriter

#创建xlsx后缀名的excel
excel = xlsxwriter.Workbook(r‘D:\github\file\xlswrite_test.xlsx‘)

#添加sheet页名称
sheet = excel.add_worksheet(‘设备名称‘)

#设置行宽,行高
sheet.set_column(‘A:C‘,30)
#设置excel样
bold = excel.add_format({‘bold‘:True})

#向excel写数据
sheet.write(‘A1‘,‘Hello‘)

#向excel写数据,并设置加粗样式
sheet.write(‘A2‘,u‘你好‘,bold)
sheet.write(‘B3‘,‘*&^%$#@!‘)

sheet.write(3,0,32)
sheet.write(4,0,35.5)
sheet.write(5,0,‘=SUM(A4:A5)‘)

#关闭excel
excel.close()


3、Python文件操作工具 xlsxwriter 工具

评论关闭