tim@laptop:~/tmp$ python Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import csv >>> from cStringIO import StringIO >>> s = StringIO('Email\n...@example.com\n...@example.org\n') >>> s.seek(0) >>> d = csv.Sniffer().sniff(s.read()) >>> s.seek(0) >>> r = csv.DictReader(s, dialect=d) >>> r.fieldnames ['Emai', '']
I get the same results using Python 3.1.3 (also readily available on Debian Stable), as well as working directly on a file rather than a StringIO. Any reason I'm getting ['Emai', ''] (note the missing ell) instead of ['Email'] as my resulting fieldnames? Did I miss something in the docs? -tkc -- http://mail.python.org/mailman/listinfo/python-list