比对两个Excel列中的元素
import openpyxl wb=openpyxl.load_workbook(r\'e:\\玩家表.xlsx\') sheet=wb[\'Worksheet\'] row_max=sheet.max_row hw_ls=[] for i in range(2,row_max+1): hw_ls.append(int(sheet.cell(row=i,column=1).value)) wb=openpyxl.load_workbook(r\'e:\\d2.xlsx\') sheet=wb[\'Sheet1\'] row_max=sheet.max_row gx_ls=[] for i in range(2,row_max+1): gx_ls.append(int(sheet.cell(row=i,column=1).value)) pass ls=[] for j in gx_ls: if j in hw_ls: pass else: ls.append(j) f=open(\'res1.txt\',\'w\') f.write(str(ls))
版权声明:本文为yuvejxke原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。