comparison - Comparing two TSV files, and then ajoining them in Python -


i've done of work, niggling problem can't life of me fix.

so, have 2 tsv files little this.

file one

"cars"    2 "cars"    1 "bikes"    21 

file two

"bikes"   21    "triumph" "cars"    2     "vauxhall.jpg" 

i correlate second file first one, end like...

"cars"    2     "vauxhall.jpg" "bikes"   21    "triumph" 

how go doing in python? have tried this...

import csv  open("../csvfiles/created/redandyellow.csv","rb") rayf:     rayfs = csv.reader(rayf, delimiter='\t', lineterminator='\n')      open("../csvfiles/photos.csv","rb") phf:             phfs = csv.reader(phf, delimiter='\t', lineterminator='\n')              phrow in phfs:                     rayrow in rayfs:                             if phrow[1] == rayrow[1]:                                                                                       print phrow[1] + ", " + phrow[1] 

to no avail.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -