4 ms·
> An issue that can still happen with python's string formatting is that you can get the number of arguments/`{}` wrong. Easily avoided by using the latest Pyt
by teddyh 8y ago
> An issue that can still happen with python's string formatting is that you can get the number of arguments/`{}` wrong.
Easily avoided by using the latest Python feature, added in 3.6: Formatted string literals, a.k.a. f-strings¹. Instead of using
"foo {} baz".format(bar)
you use
f"foo {bar} baz"
1. https://www.python.org/dev/peps/pep-0498 https://www.python.org/dev/peps/pep-0498