Re: s.split() on multiple separators
- From: mrkafk@xxxxxxxxx
- Date: Sun, 30 Sep 2007 12:07:15 -0700
['ab', 'd', '', 'ab', '', '']
Given your original string, I'm not sure how that would be the
expected result of "split c on the characters in dels".
Oops, the inner loop should be:
for i in xrange(0,len(c)):
Now it works.
>>> c=' abcde abc cba fdsa bcd '
>>> import re
>>> r = re.compile('[ce ]')
>>> r.split(c)
['', 'ab', 'd', '', 'ab', '', '', 'ba', 'fdsa', 'b', 'd', '']
given that a regexp object has a split() method.
That's probably optimum solution. Thanks!
Regards,
Marcin
.
- References:
- s.split() on multiple separators
- From: mrkafk
- Re: s.split() on multiple separators
- From: Tim Chase
- s.split() on multiple separators
- Prev by Date: Re: notify when process finishes (on unix)
- Next by Date: Re: s.split() on multiple separators
- Previous by thread: Re: s.split() on multiple separators
- Next by thread: Re: s.split() on multiple separators
- Index(es):
Relevant Pages
|