by RodericDay · 11y ago · 0 comments
>>> value = 4 * 20
>>> 'The value is {value}.'.format(value=value)
'The value is 80.'
Even in its simplest form, there is a bit of boilerplate, and the value that's inserted into the placeholder is sometimes far removed from where the placeholder is situated: >>> 'The value is {}.'.format(value)
'The value is 80.'
With an f-string, this becomes: >>> f'The value is {value}.'
'The value is 80.'
Yeah I've had this thought before. >>> 'The value is '+value+'.'
'The value is 80.'
Boilerplate? It's one extra character.