csv module
skip at pobox.com
skip at pobox.com
Wed Dec 28 07:52:53 EST 2005
Laurent> To read my CSV file, I choose to 'sniff' with a sample data in
Laurent> order to get the dialect. The problem I meet is that I get a
Laurent> wrong dialect: the sniffer return an empty string delimiter. It
Laurent> is probably a bug in _guess_delimiter() method.
Laurent> The message I obtain is:
Laurent> TypeError: bad argument type for built-in operation
Laurent> Do you know a way to sniff tab-delimited data ?
Laurent> Is it a known bug ?
Using a file with the following contents:
>>> open("tabber.csv", "rb").read()
'1\t2\tabc\n3\t4\tdef\n'
I get:
>>> sniffer = csv.Sniffer()
>>> d = sniffer.sniff(open("tabber.csv", "rb").read())
>>> d.delimiter
'\t'
Can you provide a concrete example (preferably in a bug report on SF)?
Skip
More information about the Python-list
mailing list