[issue24787] csv.Sniffer guesses "M" instead of \t or , as the delimiter

Skip Montanaro report at bugs.python.org
Tue Aug 4 03:48:34 CEST 2015


Skip Montanaro added the comment:

How are you calling the sniff() method? Note that it takes a sample of the CSV file. For example, this works for me:

>>> f = open("sniff1.csv")
>>> dialect = csv.Sniffer().sniff(next(open("sniff1.csv")))
>>> dialect.delimiter 
','
>>> dialect.lineterminator
'\r\n'

where sniff1.csv is your Dataset 1. (I think for reliable operation you really want your sample to be a multiple of whole lines.)

----------
nosy: +skip.montanaro

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24787>
_______________________________________


More information about the Python-bugs-list mailing list