首页 > 其他 > 详细

比对两个Excel列中的元素

时间:2020-05-13 09:23:11      阅读:74      评论:0      收藏:0      [点我收藏+]
import openpyxl
wb=openpyxl.load_workbook(re:\\玩家表.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(re:\\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))

 

比对两个Excel列中的元素

原文:https://www.cnblogs.com/yuvejxke/p/12880039.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!