On 10.09.2008, Anjanesh Lekshminarayanan <[EMAIL PROTECTED]> wroted: > In PHP, if I do > str_replace(array('a', 'e', 'i', 'o', 'u'), '-', $str) > it'll replace all vowels with a hyphen in string $str. > > Is there some equivalent in Python ?
The .translate() method of strings? >>> import string >>> mystr = "This is just a test" >>> transtable = string.maketrans("aeiouy","------") >>> mystr.translate(transtable) 'Th-s -s j-st - t-st' GS -- Grzegorz Staniak <gstaniak _at_ wp [dot] pl> Nocturnal Infiltration and Accurate Killing -- http://mail.python.org/mailman/listinfo/python-list