Paddy wrote: > [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? > > > > Thanks. > > > > Martin > > I resisted my urge to use a regexp and came up with this: > > >>> from itertools import groupby > >>> s = 'apple=blue+cart' > >>> [''.join(g) for k,g in groupby(s, lambda x: x in '=+')] > ['apple', '=', 'blue', '+', 'cart'] > >>> > > For me, the regexp solution would have been clearer, but I need to > stretch my itertools skills. > > - Paddy. Arghhh! No colon! Forget the above please.
- Pad. -- http://mail.python.org/mailman/listinfo/python-list