Mega Code Archive

 
Categories / Python Tutorial / String
 

If the replacement field is part of a word, the name must be enclosed in braces

from string  import Template s = Template("It's ${x}tastic!") s.substitute(x='slurm') print s