Re: is there any lib can split string in this way?

2006-01-09 Thread bonono
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']

is there any lib can split string in this way?

2006-01-08 Thread Leo Jay
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

Re: is there any lib can split string in this way?

2006-01-08 Thread Bengt Richter
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

Re: is there any lib can split string in this way?

2006-01-08 Thread Fredrik Lundh
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 --