[Csv] multi-character delimiters, take two
Skip Montanaro
skip at pobox.com
Fri Feb 7 00:07:02 CET 2003
>> Lo and behold, there was a fairly nice looking CSV file, all fields
>> quoted with '"', except... the delimiter is two spaces.
Andrew> You might find that two spaces never appear in the data fields,
Andrew> in which case this might work:
Andrew> fields = line.split(' ')
Sure, it might, but then I'm back to hackish wing-and-a-prayer parsing.
Andrew> BTW, have you tried using the csv parser with delimiter set to
Andrew> space, and skipinitialspace set to true?
Not yet. Good suggestion though. I will give it a try later.
>> So now I've encountered two examples .... Any chance the
>> len(delimiter) == 1 restriction could be relaxed?
Andrew> Not without some hairy work on the state machine. The more
Andrew> complicated we make the state machine, the more likely we are to
Andrew> let a nasty bug slip through, so I'm rather reluctant.
Point taken, and since you guys on summer vacation are the BDFLs of that
code, your word is law. Still, don't be surprised to hear someone ask for
it just after 2.3 is out. ;-)
Skip
More information about the Csv
mailing list