title: Find a specific header in a CSV file using python 3 code
body: <p>right now I have Python 3 code that takes a column of data within a CSV file, delimits the phrases in each cell into individual words based on spaces, then exports the data back into a new CSV file.  </p>
  
  <p>What I am wondering about is if there is a way to tell python to only apply the formatting code to a specific column with a particular header?</p>
  
  <p>Here is what my source data looks like</p>
  
  <pre><code>Keyword              Source       Number 
  Lions Tigers Bears     US          3
  Dogs Zebra            Canada       5
  Sharks Guppies         US          2
  </code></pre>
  
  <p>and here is my code which delimits the phrases in each cell into individual words based on a space </p>
  
  <pre><code>with open(b'C:\Users\jk\Desktop\helloworld.csv', 'r') as datafile:
      data = []
      for row in datafile:
          data.extend(item.strip() for item in row.split())
  with open('test.csv', 'w') as a_file:
      for result in data:
          result = ''.join(result)
          a_file.write(result + '\n')
          print(result)
  </code></pre>
  
  <p>so that the source data becomes</p>
  
  <pre><code> Keywords         Source         Number
   Lions            US              3
   Tigers
   Bears
   Dogs             Canada          5
  </code></pre>
  
  <p>etc                </p>
  
  <p>In this case, I only need all of this code to apply to the one column with the heading <code>Keyword</code>.  Ideally, what I am trying to do is also extend the data found in the "Source" and "Number" to these newly created rows (Lions US 3 -- Tigers US 3 -- Bears US 3  etc) but I haven't really figured out that part yet!</p>
  
  <p>I've been poking around the forum for awhile trying to find an answer and I know you can tell python to read the first line of the CSV file where the headers are placed (<code>headers = file.readline()</code>) but beyond that I am lost.  Would this be an easier task using the CSV reader?</p>