python excel 配对

from openpyxl import load_workbook
import shutil


comparebook = "2.XLSX"
comparebook2 = "Device List 20190603.xlsx"

wb = load_workbook(comparebook)
wa = load_workbook(comparebook2)
sheet_a = wb['Sheet1']
sheet_b = wa['PCs']

dict = {}
dictb = {}
vat_n = 2
while vat_n <= sheet_b.max_row :
    a = sheet_a.cell(row=vat_n, column=7).value
    b = sheet_a.cell(row=vat_n, column=1).value
    try:
        dict[a.rstrip()] = b.rstrip()
    except:
        print("找不到序列号")

    vat_n +=1

nu = 2
while nu <= sheet_a.max_row:
    q = sheet_a.cell(row=nu, column=6).value
    sheet_a.cell(row=nu, column=1).value = dict[q]

    nu +=1


wb.closed()
wc.save("Device List 20190612.xlsx")

print("匹配完成!请打开:2.XLSX")