title: Python Looping through CSV files and their columns
body: <p>so I've seen this done is other questions asked here but I'm still a little confused. I've been learning python3 for the last few days and figured I'd start working on a project to really get my hands dirty. I need to loop through a certain amount of CSV files and make edits to those files. I'm having trouble with going to a specific column and also for loops in python in general. I'm used to the convention (int i = 0; i &lt; expression; i++), but in python it's a little different. Here's my code so far and I'll explain where my issue is.</p>
  
  <pre><code>import os
  import csv
  
  pathName = os.getcwd()
  
  numFiles = []
  fileNames = os.listdir(pathName)
  for fileNames in fileNames:
      if fileNames.endswith(".csv"):
          numFiles.append(fileNames)
  
  for i in numFiles:
      file = open(os.path.join(pathName, i), "rU")
      reader = csv.reader(file, delimiter=',')
      for column in reader:
          print(column[4])
  </code></pre>
  
  <p>My issue falls on this line:</p>
  
  <pre><code>for column in reader:
          print(column[4])
  </code></pre>
  
  <p>So in the Docs it says column is the variable and reader is what I'm looping through. But when I write 4 I get this error:</p>
  
  <pre><code>IndexError: list index out of range
  </code></pre>
  
  <p>What does this mean? If I write 0 instead of 4 it prints out all of the values in column 0 cell 0 of each CSV file. I basically need it to go through the first row of each CSV file and find a specific value and then go through that entire column. Thanks in advance!</p>