csv module
skip at pobox.com
skip at pobox.com
Wed Dec 28 07:55:46 EST 2005
me> Using a file with the following contents:
me> >>> open("tabber.csv", "rb").read()
me> '1\t2\tabc\n3\t4\tdef\n'
me> I get:
me> >>> sniffer = csv.Sniffer()
me> >>> d = sniffer.sniff(open("tabber.csv", "rb").read())
me> >>> d.delimiter
me> '\t'
BTW, this also seems to work with a Mac-style EOL:
>>> open("tabber.csv", "rb").read()
'1\t2\tabc\r3\t4\tdef\r'
>>> d = sniffer.sniff(open("tabber.csv", "rb").read())
>>> d.delimiter
'\t'
Perhaps this has been fixed in CVS.
Skip
More information about the Python-list
mailing list