标签:read coding continue 姓名 code column object filename open
# -*- coding: UTF-8 -*- from openpyxl import load_workbook from openpyxl import Workbook # 以‘xxx花名册.xlsx‘为准 yuanbook = load_workbook(filename=‘xxx花名册.xlsx‘,read_only=True) objectbook = load_workbook(‘花名册0523.xlsx‘) yuansheet = yuanbook[‘X‘] objectsheet = objectbook[‘XXX‘] for i in range(4,761): for j in range(4,761): cell_yuansheet = yuansheet.cell(row=i, column=3) cell_objectsheet = objectsheet.cell(row=j, column=3) yuancell_s = str(cell_yuansheet.value) objectcell_s = str(cell_objectsheet.value) print(‘正在处理‘,i,j) if objectcell_s == yuancell_s: result_cell = objectsheet.cell(row=i, column=18) result_cell.value = ‘存在‘ print(f‘正好是{i}和{j}‘) break else: continue objectbook.save(‘花名册0523.xlsx‘)
标签:read coding continue 姓名 code column object filename open
原文地址:https://www.cnblogs.com/nfcf/p/12952379.html