php has the strtr function:
strtr(\'aa-bb-cc\', array(\'aa\' => \'bbz\', \'bb\' => \'x\', \'cc\' => \'y\'));
# bbz-x-y
It replace
The answers on this thread are so out-dated. Here we go...
"Hello there {first_name} {last_name}".format(first_name="Bob", last_name="Roy")
from string import Template
t = Template('Hello there $first_name $last_name')
t.substitute(first_name="Bob", last_name="Roy")
Reference: Python String Formatting Best Practices