title: Python 3: Nested for loops skipping nested loops
body: <pre><code>import csv
  
  data = {}
  f = open("train.csv")
  csv_f = csv.reader(f)
  labels = next(csv_f)
  for i in range(len(labels-1)):
      a = []
      for row in csv_f:
          a += row[i]
      data [labels[i]] = a
  </code></pre>
  
  <p>I am doing the code above trying to read a csv file and put the columns into a dictionary with the first part as the labels and the second part as the arra of the values. This works for my first column, which for my data set is 'ID', but it stops working after that -- it just leaves the <code>a</code> array as blank. I did some debugging and found that it was doing the outer for loop then the inner loop, but then when it did the second run through of the outer for loop, it just skipped the inner for loop. It did that for all subsequent ones also.</p>
  
  <p>Why does it do that?</p>
  
  <p>And how can I fix my code to make it stop?</p>