I'm having a little trouble with something I thought should be quite easy.
I have two files, both tsv
. One is a list of names like so:
Thing1
Thing2
Thing3
Thing4
...
The other is a list of interactions between these 'things', it looks like so:
Thing1 Thing2 0.726
Thing3 Thing2 0.742
Thing1 Thing4 0.761
All I'd like to do is take the list and return the names of items on that list, which appear in my second interaction file. I thought this should be fairly straight forward but I can't seem to get it working.
So far I have tried a few things but the most basic looks like so:
import csv
import sys
ints = sys.argv[1]
name_list = open('Names', 'rb')
int_list = open(ints, 'rb')
for i in int_list:
for names in name_list:
if i == name:
print(name)
I'm sure I'm missing something very basic here but any help would be much appreciated.
Cheers :)