is there any lib can split string in this way?

Fredrik Lundh fredrik at
Mon Jan 9 02:24:23 EST 2006

Leo Jay wrote:

> I want to split a string like this:
> 'abc  def  "this is a test"  ok'
> into:
> ['abc', 'def', 'this is a test', 'ok']
> is there any lib meet my need?

>>> s = 'abc  def  "this is a test"  ok'

>>> import shlex
>>> shlex.split(s)
['abc', 'def', 'this is a test', 'ok']


More information about the Python-list mailing list