Back
I have a string which is like this:
this is "a test"
I'm trying to write something in Python to split it up by space while ignoring spaces within quotes. The result I'm looking for is:
['this','is','a test']
You want split, from the shlex module.
>>> import shlex >>> shlex.split('this is "a test"') ['this', 'is', 'a test']
>>> import shlex
>>> shlex.split('this is "a test"')
['this', 'is', 'a test']
31k questions
32.8k answers
501 comments
693 users