title: Reading header of csv file and seeing if it matches a dictionary key, then write value of that key to row
body: <p>Basically I'll have a bunch of small dictionary, like such:</p>
  
  <pre><code>dictionary_list = [
  {"eight": "yes", "queen": "yes", "we": "yes", "eighteen": "yes"},
  {"nine": "yes", "king": "yes","we": "yes", "nineteen": "yes"}
  ]
  </code></pre>
  
  <p>Then I have a csv file with a whole bunch of columns with words in the header as well, like this:
  <a href="https://i.stack.imgur.com/oknN5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oknN5.png" alt="enter image description here"></a>
   There could be 500 columns each with 1 word, and I don't know the order of which a column appears. I do, however, know that any word in my small dictionary should match to the word in a column.</p>
  
  <p>I want to iterate through the headers of the file (skipping first to the 5 column headers) and each time see if the header name can be found in the dictionary, and if so, add the value into that row, if not, add a "no". This will be done row by row, where each row is for one of the small dictionaries. Results using the above dictionary for this file would be:<br>
  <a href="https://i.stack.imgur.com/onfIV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/onfIV.png" alt="enter image description here"></a></p>
  
  <p>So far I've been able to try the following that doesn't really work:</p>
  
  <pre><code>f = open("file.csv", "r")
  writer = csv.DictWriter(f)
  for dict in dictionary_list: # this is the collection of little dictionaries
      # do some other stuff
      for r in writer: 
          #not sure how to skip 10 columns here. next() seems to work on rows 
          for col in r:
              if col in dict.keys():
                   writer.writerow(dict.values())
               else:
                   writer.writerow("no")
  </code></pre>