# coding:utf-8#==================================================================================
# Author:changbo-email:[email protected]#Last modified:2017-4-8#filename:run_status.py#description:create File 952700000ach5q05 operation, Base Xlswriter
# Blog:http://www.cnblogs.com/changbo#==================================================================================import Xlsxwriterimport Timenowtime = Time.strftime ('%y-%m-%d ', Time.localtime (Time.time ())) Nowtime1 = (time.strftime (' _%y_%m_%d ', Time.localtime (Time.time ())). Strip () file_name = U ' 952700000ach5q05 operating condition%s.xlsx '% nowtime1title = [u ' PIR alarm number ', U ' Wan wake-up Times ', U ' wake on LAN ', U ' Codec total duration ', U ' Codec duration (color) ', U ' Codec duration (black and white) ', U ' Codec continuous run time (alarm) ', U ' Codec Duration (preview) ', u ' soft restart count ', U ' hard restart count ', u ']title1 = [u ' the day ', U ' last one months ']def titlename (): # Create File workbook = Xlsxwriter. Workbook (file_name) Merge_format = Workbook.add_format ({' bold ': True, ' align ': ' Center ', ' valign ') : ' Vcenter ',}) # Create sheet worksheet = Workbook.add_worksheet () worksheet.set_column (0, +) workshe Et.merge_range (0, 0, 1, 0, u ' date ', Merge_format) worksheet.merge_range (0, 1, 1, 1, U ' current version (latest? ) ', Merge_format) worksheet.write (' A3 ', nowtime) x =-1 for i in range (67, 87, 2): Toptitle = '%s1:%s1 '% (Chr (i), Chr (i + 1)) Secondtitle = '%s2 '% chr (i) secondtitle2 = '%s2 '% chr (i + 1) x + = 1 Worksheet.merge_range (toptitle, title[x], Merge_format) worksheet.write (secondtitle, Tit Le1[0], Merge_format) worksheet.write (Secondtitle2, title1[1], Merge_format) worksheet.merge_range (' W1:w2 ', U ' the same day AP drop-off times ', Merge_format) worksheet.merge_range (' X1:aa1 ', U ' Power Information ', Merge_format) worksheet.write (' X2 ', u ' installation case ', Merge_f ormat) worksheet.write (' Y2 ', u ' battery type ', Merge_format) worksheet.write (' Z2 ', U ' supply case ', Merge_format) Worksheet.write ( ' AA2 ', U ' remaining power ', Merge_format) worksheet.merge_range (' Ab1:ab2 ', U ' codec the number of crashes ', Merge_format) workbook.close () retur nif __name__ = = ' __main__ ': TitleName ()
end!
Python Excel table Operations