This has been asked not long ago. the shlex module as well as csv
module both should be able to handle it. for this simple case
shlex.split() seems to be the easiest.
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']
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?
thanks
--
Best Regards,
Leo Jay
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 9 Jan 2006 13:59:44 +0800, Leo Jay [EMAIL PROTECTED] 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?
Narrowly interpreting your requirements (only quotes are with
double quotes (never
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']
/F
--