title: How to skip pre header lines with csv.DictReader?
body: <p>I want to <code>csv.DictReader</code> to deduce the field names from the file. <a href="http://docs.python.org/library/csv.html#csv.DictReader" rel="noreferrer">The docs</a> say <em>"If the fieldnames parameter is omitted, the values in the first row of the csvfile will be used as the fieldnames."</em>, but in my case the first row containts a title and the 2nd row which contains the names.</p>
  
  <p>I can't apply <code>next(reader)</code> as per <a href="https://stackoverflow.com/questions/4787723/python-3-2-skip-a-line-in-csv-dictreader">Python 3.2 skip a line in csv.DictReader</a> because the fieldname assignment takes place when initializing the reader (or I'm doing it wrong).</p>
  
  <p>The csvfile (exported from Excel 2010, <a href="http://ftp2.cits.rncan.gc.ca/pub/canvec/doc/CanVec_EntitiesCodesFileNames_EntitesCodesNomsDeFichier_v1_1_1.xls" rel="noreferrer">original source</a>):</p>
  
  <pre><code>CanVec v1.1.0,,,,,,,,,^M
  Entity,Attributes combination,"Specification Code
  Point","Specification Code
  Line","Specification Code
  Area",Generic Code,Theme,"GML - Entity name
  Shape - File name
  Point","GML - Entity name
  Shape - File name
  Line","GML - Entity name
  Shape - File name
  Area"^M
  Amusement park,Amusement park,,,2260012,2260009,LX,,,LX_2260009_2^M
  Auto wrecker,Auto wrecker,,,2360012,2360009,IC,,,IC_2360009_2^M
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>f = open(entities_table,'rb')
  try:
      dialect = csv.Sniffer().sniff(f.read(1024))
      f.seek(0)
  
      reader = csv.DictReader(f, dialect=dialect)
      print 'I think the field names are:\n%s\n' % (reader.fieldnames)
  
      i = 0
      for row in reader:
          if i &lt; 20:
              print row
              i = i + 1
  
  finally:
      f.close()
  </code></pre>
  
  <p>Current results:</p>
  
  <pre><code>I think the field names are:
  ['CanVec v1.1.0', '', '', '', '', '', '', '', '', '']
  </code></pre>
  
  <p>Desired result:</p>
  
  <pre><code>I think the field names are:
  ['Entity','Attributes combination','"Specification Code Point"',...snip]
  </code></pre>
  
  <p>I realize it would be expedient to simply delete the first row and carry on, but I'm trying to get as close to just reading the data in situ as I can and minimize manual intervention.</p>