On Sep 10, 12:20 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Anjanesh Lekshminarayanan wrote:
> >> import re
> >> new_str = re.sub('[aeiou]', '-', str)
> > Wow - this is neat. Thanks
>
> But probably slower and definitely harder to understand. For simple
> problems the str methods are usually faster than a regular expression.
>
> ChristianIt's true that regular expressions are generally slower, but I disagree that it's hard to understand. When dealing with text, I think it's an absolute must that programmers know about regular expressions. I think this here is an example where even str_replace in Python wouldn't have worked well. -David http://www.thedarktrumpet.com -- http://mail.python.org/mailman/listinfo/python-list
