Splitting a line while keeping quoted items together

Tim Chase python.list at tim.thechases.com
Mon Nov 19 20:20:16 EST 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