Home

> > ['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

previous
next

Re: Making a small change to a large XML document
Re: Requesting critique of a C unit test environment
Re: Conversions from decimal to binary,hex
Re: An ordered dictionary for the Python library?
Re: Passing arrays to C funcions
Fundacja Iskierka
Niechciane i Zapomniane
Mam Marzenie
Nasze Dzieci
Fundacja Hobbit