Splitting a line while keeping quoted items together

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Nov 20 02:09:54 CET 2012

On Mon, 19 Nov 2012 16:05:30 -0800, josh wrote:

> I am working on a cmd.Cmd-based program, and normally could just split
> the string and get the right parts.
> Now I have a case where I could have two or three words in the string
> that need to be grouped into the same thing.

Try shlex.split.


More information about the Python-list mailing list