Created
October 2, 2012 08:57
-
-
Save fangpenlin/3817542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
f2_ids = set() | |
f2 = open('file2.txt', 'rt') | |
f2_reader = csv.reader(f2) | |
for row in f2_reader: | |
f2_ids.add(row[0]) | |
f1 = open('file1.txt', 'rt') | |
for line in f1.readlines(): | |
line = line.strip() | |
parts = line.split(',') | |
id = parts[0].strip('"') | |
if id in f2_ids: | |
print line | |
f1 = open('file1.txt', 'rt') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment