[Tutor] Creating a match file

Emile van Sebille emile at fenx.com
Tue Sep 22 00:50:02 CEST 2015


On 9/20/2015 12:19 PM, EILEEN CHURCH CARSON wrote:

> I want to write a program that reads in data from two csv files with 6
> columns each. I want it to determines if the data in the first two columns
> is the same, and if so read all six columns in that line from each of the
> two files into a 12 column output file.

I think I'd read in the first file and create a dictionary using the 
first two fields as the key, and the remaining six fields as the data. 
then, read in the second file, loop through again creating a key of the 
first two fields and if that exists in the first dictionary, get that 
data and write all 12 fields to a new dictionary.  When done, write the 
results to the output file.

Emile




More information about the Tutor mailing list