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
Post a Comment