Splitting a line while keeping quoted items together

Tim Chase python.list at tim.thechases.com
Tue Nov 20 02:20:16 CET 2012


>> Use the "shlex" module in the std lib?
>
> Well color me ignorant.
> 
> Works cleanly. I shouldn't have reinvented the wheel.

I've experienced this enough:  the csv module, option parsing,
config-file parsing, logging, timeit, and pwd all come to mind as
code I've written before realizing the stdlib already has it.  Now,
if my task sounds remotely like something that somebody else might
have implemented already, my first stop is always to browse through
the stdlib docs.  Then try http://pypi.python.org/pypi to see if
somebody else has already solved the problem without the solution
getting into the stdlib.  Only then do I proceed to trying to code
up something of my own.

-tkc




More information about the Python-list mailing list