string templates in python code example
Example 1: new python string formatting
>>> f'Hello, {name}!'
'Hello, Bob!'
Example 2: template strings in python
>>> 'Hello, {}'.format(name)
name='Bob'
'Hello, Bob'
Example 3: string template python
from string import Template
poem = Template('$x are red and $y are blue')
print(poem.substitute(x='roses', y='violets'))
#>>>roses are red and violets are blue