Am Donnerstag 18 Mai 2006 10:21 schrieb Giovanni Bajo: > Heiko Wundram <[EMAIL PROTECTED]> wrote: > > Don't get me wrong, I personally find this functionality very, very > > interesting (I'm +0.5 on adding it in some way or another), > > especially as a > > part of the standard library (not necessarily as an extension to > > .split()). > > It's already there. It's called shlex.split(), and follows the semantic of > a standard UNIX shell, including escaping and other things.
I knew about *nix shell escaping, but that isn't necessarily what I find in input I have to process (although generally it's what you see, yeah). That's why I said that it would be interesting to have a generalized method, sort of like the csv module but only for string "interpretation", which takes a dialect, and parses a string for the specified dialect. Remember, there also escaping by doubling the end of string marker (for example, '""this is not a single argument""'.split() should be parsed as ['"this','is','not','a',....]), and I know programs that use exactly this format for file storage. Maybe, one could simply export the function the csv module uses to parse the actual data fields as a more prominent method, which accepts keyword arguments, instead of a Dialect-derived class. --- Heiko. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com