s = "text $count$ text"
print s
s.replace("$name$",str(99))
print s
s.replace(str(99),"$name$")
print s
text $count$ text
text $count$ text
text $count$ text
s = "text $count$ text".replace('$count$',str(99))
print s
s = "%s"%(s).replace(str(99),"$count$")
print s
print 'Hello'.replace('l', 'L')text 99 text
text $count$ text
HeLLo
Версия питона 2.7 .