Python - Strings Very Much Attached

Now this is what you do all the time to strings in Python:

something = 'text'
print 'some %s' % something

But what if you don’t know what you want to insert into a string during programming time? Well then you need the Python string module. It contains all kinds of light templating tools which allow you to do this:

import string

some_text = 'hello $something'
template = string.Template(some_text)
print template.substitute(something='world')