本文实例讲述了Python实现求两个csv文件交集的方法。分享给大家供大家参考,具体如下:
#!/usr/bin/env pythonrd3 = open('data_17_17_2.csv')base = open('data_17_17_3.csv')wr3 = open('delNoBuyed3DayAndStoreAndInCar4.5.2.csv','w+')bsData = base.readlines()i = 1for key in rd3: if key in bsData: wr3.write(key) if i == 1: print key i = (i + 1)%100rd3.close()base.close()wr3.close()
希望本文所述对大家Python程序设计有所帮助。
新闻热点
疑难解答