def init_work_sheet(self): self.work_sheet = self.write_book.add_sheet('independent_combs_%s' % self.work_sheet_num) self.work_sheet_num += 1 write_data.write_header_row(self.work_sheet, 'result_combs') self.row_num = 1
def write_independent_comb_result(filename, independent_combs): read_book = xlrd.open_workbook(filename=filename) write_book = copy(read_book) work_sheet_num = 0 work_sheet = write_book.add_sheet(u'indepenent_combs_%s' % work_sheet_num) write_data.write_header_row(work_sheet, 'result_combs') row_num = 1 for combs in independent_combs: work_sheet.write(row_num, 0, combs[u'组合个数']) work_sheet.write(row_num, 1, combs[u'result序号']) work_sheet.write(row_num, 2, combs[u'攻击x暴伤']) work_sheet.write(row_num, 3, combs[u'速度']) row_num += 1 if row_num > 65535: work_sheet_num += 1 work_sheet = write_book.add_sheet(u'indepenent_combs_%s' % work_sheet_num) write_data.write_header_row(work_sheet, 'result_combs') file_name, file_extension = os.path.splitext(filename) result_file = file_name + '-comb' + file_extension write_book.save(result_file)