title: Error writing from DictReader into CSV
body: <p>I have the following code:</p>
  
  <pre><code>def fillBlanks():
  
      # There are duplicate fields in the 'HEADERS' list. A better 'HEADERS' list might be:
      # HEADERS = ['ST', 'Year', 'PCT_SHORT', 'PCT_V_SHORT']
      HEADERS =['ST','Year','PCT_SHORT','PCT_V_SHORT','Year','PCT_SHORT','PCT_V_SHORT','Year','PCT_SHORT','PCT_V_SHORT' ]
      fileH = open(outputDir+"PCT_SHORT_V_SHORT.csv", 'rb')
      fileb = open(outputDir+"PCT_SHORT_V_SHOR.csv", 'wb')
      reader = csv.DictReader(fileH, HEADERS,restval=0)
  
      for row in reader:
        print row
  </code></pre>
  
  <p>It outputs, the following:</p>
  
  <pre><code> # The `None` key is the result of the data row having more columns than the 'HEADERS' list has fields.
   {None: ['2012', '36', '12'], 'PCT_SHORT': '19', 'Year': '2013', 'PCT_V_SHORT': '17', 'ST': 'OK'}
   {'PCT_SHORT': 0, 'Year': 0, 'PCT_V_SHORT': 0, 'ST': 'AZ'}
   {None: ['2012', '14', '1'], 'PCT_SHORT': '24', 'Year': '2013', 'PCT_V_SHORT':  '2', 'ST': 'ID'}
  </code></pre>
  
  <p>where 0 fills in fields that were previously missing.</p>
  
  <p>How do I go about writing each row of this out to a CSV. I have been trying to use something along the lines of.</p>
  
  <pre><code>with(fileb) as out:
    csv_out=csv.writer(out)
  
  csv_out.writerow(['ST','Year','PCT_SHORT','PCT_V_SHORT','Year','PCT_SHORT','PCT_V_SHORT','Year','PCT_SHORT','PCT_V_SHORT','Year','PCT_SHORT','PCT_V_SHORT'])
  
  for row in reader:
    csvwriters.writerow(row)
  </code></pre>
  
  <p>I get a Error! </p>
  
  <pre><code>sequence expected
  </code></pre>
  
  <p>I have also tried to use DictWriter, but I am not familiar with it. I am very new to python. is there anyway to simply write the resulting rows of the DictReader to a new CSV?</p>