[EMAIL PROTECTED] wrote:
> Hi, I'm looking for something like:
> 
> multi_split( 'a:=b+c' , [':=','+'] )
> 
> returning:
> ['a', ':=', 'b', '+', 'c']
> 
> whats the python way to achieve this, preferably without regexp?

What do you have against regexp? re.split() does exactly what you want:

In [1]: import re

In [2]: re.split(r'(:=|\+)', 'a:=b+c')
Out[2]: ['a', ':=', 'b', '+', 'c']

Kent
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to