PHP's str_replace ?

Christian Heimes lists at
Wed Sep 10 19:20:31 CEST 2008

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.


More information about the Python-list mailing list