smart splitting - how to

Chris Angelico rosuav at gmail.com
Fri Dec 13 12:35:57 CET 2013


On Fri, Dec 13, 2013 at 10:28 PM, Helmut Jarausch
<jarausch at igpm.rwth-aachen.de> wrote:
> Now, a simple split doesn't work since it splits the quoted text as well.
> Is there a simple way to do so?
> It would be nice if it could handle embedded quotes which are escaped
> by a backslash, too.

Sounds like you want shell-style splitting. Check out the shlex module:

http://docs.python.org/3.3/library/shlex.html

ChrisA



More information about the Python-list mailing list