from string import Template
data = dict(item = "candy", price = 8, qty = 2)
# define the template
t = Template("Simon bought $qty $item for $price dollar")
print(t.substitute(data))
Output:
Simon bought 2 candy for 8 dollar
Templates support $-based substitution...