title: Python dictionary keys to csv file with column match
body: <p>I'm trying to push multiple dictionaries (keys and values) to a csv file by matching the key to a column in the csv header. 
  Example:</p>
  
  <pre><code>import csv
  d1 = {'a':1, 'b':2, 'c': 3}
  d2 = {'d':4, 'e':5, 'f': 6}
  with open('my_data.csv','wb') as f:
      w = csv.writer(f)
      w.writerow(['a', 'b', 'c', 'd', 'e', 'f'])
  
  #iterate through all keys in d1,d2,dn
  #if key matches column:
      #write value of key to the bottom of column
  #else:
      #error key not found in header
  </code></pre>
  
  <p>expected result in mydata.csv</p>
  
  <pre><code>a,b,c,d,e,f
  1,2,3,4,5,6
  </code></pre>