t = string.Template('Hello my name is $name')
print(t.substitute(name='Guido'))
t = 'Hello my name is %(name)s'
print(t % dict(name='Tim'))
t = 'Hello my name is {name}'
print(t.format(name='Barry'))
Замена подстроки строки на Python