Hi All
I have two tab-delimited files. I want to compare first column of testfile1 to first column of testfile2 to find if items in file2 are in file1 and write it to the new file.
I have a following code but not working!! :(.
f1 = open('testfile1.txt')
#f2 = open('testfile2.txt')
for line in f1:
a = line.split()
list1 = a[0].split()
print list1
print "now printing list 2"
f2 = open('testfile2.txt')
for line in f2:
b = line.split()
list2 = b[0].split()
print list2
for i,e1 in enumerate(list1):
for e2 in (list2):
if e2 in e1:
print ("line %d : %s" % (i,e1))
else:
print"No matching entries"
f1.close()
f2.close()
Any helps?