* separated values

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Tue Jan 15 08:42:10 EST 2002


Every now and then someone asks for a library for parsing
comma-separated values. Of course, using file iterators and string
methods, "well-behaved" csv may be parsed with two lines of Python.
However, if one allows various types of delimiters (e.g. tabs) and
quoting (including quoting line breaks), things become more complex.

There are several implementations out there; searching the vaults of
parnassus for csv turned up 11 libraries. I'm sure all of these are
OK, but it would be nice to have one "canonical" implementation which
one could depend on behaving correctly...

Basically, what I'm wondering is whether it would be possible to add
such a beast to the standard library. It seems like a very natural
format to support, doesn't it? I mean, if we have ConfigParser, why
not csv? I sure that getting some usable code wouldn't be a problem...
(If needed, I would gladly write it and put it in the public domain or
whatever.)

It just seems like a shame that this handy little wheel has to be
reinvented over and over again :)

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list