I need to compare two tsv files and save needed data to another file.
Tsv_file stands for imdb data file which contains id-rating-votes separated by tab stop and Tsv_file2 stands for my file which contais id-year separated by tab stop
All id's from tsv_file2 are in tsv_file, I need to save to zapis file data in format id-year-rating, where id from tsv_file2 matches id from tsv_file.
The problem is that code below is working but it is saving only one line into zapis file.
What can i improve to save all records?
for linia in read_tsv2:
for linia2 in read_tsv:
if linia[0] == linia2[0]:
zapis.write(linia[0]+'\t')
zapis.write(linia[1]+'\t')
zapis.write(linia2[1])