[issue2078] CSV Sniffer does not function properly on single column .csv files

Skip Montanaro report at bugs.python.org
Sat Mar 29 16:15:27 CET 2008


Skip Montanaro <skip at pobox.com> added the comment:

>> It works entirely based on chracter frequencies.

    Amaury> Does it make sense to restrict delimiters to a reasonable set of
    Amaury> characters? Usual punctuations, spaces, tabs... what else?

There is an optional delimiters argument to the sniff() method which
defaults to None.  I would be happier if it was "the usual suspects"
(NeoOffice refuses to gues, but offers TAB, space, semicolon and comma as
the default separators when importing a CSV file - Excel seems to just
figure it out).  That would change the behavior though.  With no delimiter
set it's generally going to find something, just pick incorrectly.  With a
non-existent delimiter set it's going to raise an exception.  I'm not sure
this would be a good tradeoff and would just break existing code.

Skip

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2078>
__________________________________


More information about the Python-bugs-list mailing list