Re: multi split function taking delimiter list

2006-11-16 Thread Paul McGuire
On Nov 14, 5:41 pm, "Sam Pointon" <[EMAIL PROTECTED]> wrote: > On Nov 14, 7:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Hi, I'm looking for something like: > > > multi_split( 'a:=b+c' , [':=','+'] ) > > > returning: > > ['a', ':=', 'b', '+', 'c'] > > > whats the python way to achi

Re: multi split function taking delimiter list

2006-11-16 Thread Frederic Rentsch
Paddy wrote: > Paddy wrote: > >> 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? >

Re: multi split function taking delimiter list

2006-11-15 Thread Paddy
Paddy wrote: > 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? > > > > >

Re: multi split function taking delimiter list

2006-11-14 Thread Paddy
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 m

Re: multi split function taking delimiter list

2006-11-14 Thread Sam Pointon
On Nov 14, 7:56 pm, "[EMAIL PROTECTED]" <[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? pyparsing

Re: multi split function taking delimiter list

2006-11-14 Thread Paddy
[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:

Re: multi split function taking delimiter list

2006-11-14 Thread Kent Johnson
[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

Re: multi split function taking delimiter list

2006-11-14 Thread Peter Otten
[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? I think in this case the regexp approach is the simplest, though: >>> def mu

Re: multi split function taking delimiter list

2006-11-14 Thread Raymond Hettinger
[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? I think regexps are likely the right way to do this kind of tokenization. The s

multi split function taking delimiter list

2006-11-14 Thread [EMAIL PROTECTED]
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 -- http://mail.python.org/mailman/listinfo/python-list