本文实例讲述了Python实现求两个csv文件交集的方法。分享给大家供大家参考,具体如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#!/usr/bin/env python
rd3 = open ( 'data_17_17_2.csv' )
base = open ( 'data_17_17_3.csv' )
wr3 = open ( 'delNoBuyed3DayAndStoreAndInCar4.5.2.csv' , 'w+' )
bsData = base.readlines()
i = 1
for key in rd3:
if key in bsData:
wr3.write(key)
if i = = 1 :
print key
i = (i + 1 ) % 100
rd3.close()
base.close()
wr3.close()
|
希望本文所述对大家Python程序设计有所帮助。
原文链接:http://blog.csdn.net/ozuoqi/article/details/44886385