On 10.09.2008, David Thole <[EMAIL PROTECTED]> wroted: >> >> 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. > > It'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.
What about mystring.translate(transtable)? GS -- Grzegorz Staniak <gstaniak _at_ wp [dot] pl> Nocturnal Infiltration and Accurate Killing -- http://mail.python.org/mailman/listinfo/python-list