How does this python script see the correct column?
<p>I am running this script with great success but was curious about how it is referencing the data. (How else am I to learn?)</p>

<pre><code>input_file = Cars.csv    
with open(input_file) as f:
    reader = csv.reader(f)
    next(reader)
    cars_list = tuple([row[1] for row in reader])

template_cars ="C:\\Data\\CarsTemplate.txt"
cars_textfile = "C:\\Data\\Cars.txt"
shutil.copyfile(template_cars,cars_textfile)

with open(cars_textfile, 'a') as f:
    if len(cars_list) == 0:
        cars_Sentence = ""

    elif len(cars_list) == 1:
        cars_Sentence = "A  %s is parked on the street." % cars_list

    elif len(cars_list) == 2:
        cars_Sentence = "Cars %s and %s are parked on the street." % cars_list

    else:
        for record in cars_list:
            cars_Sentence = "Cars " + ('%s, ' * (len(cars_list)-1) + 'and %s') % tuple(cars_list) + " are parked on the street"

    f.write(cars_Sentence)
f.close()
</code></pre>

<p>My Cars.csv file's data:  </p>

<pre><code>RecNo,Model,ItemNo,Count  
1,Prius,1,1  
2,Civic,2,3  
3,Lexus,1,5  
4,Jetta,5,1  
5,Subaru,0,0  
</code></pre>

<p>Given the code above, which works for my data, how does it know to print out the Model column and not the other colums? I figure it has something to do with the column containing strings rather than numbers. </p>

<p>If my data had two columns of strings instead of one, how would I just reference the column I want and output the same results? Just curious. Trying to get my head around coding.</p>

<p>Again, thanks to all that help me out.</p>
