August 2019
Beginner
482 pages
12h 56m
English
In all cases, you can format injected values along the way by using Python's formatting mini-language. Just add a colon after your expression in the curly brackets, and then write the mini-language notation. Take this example:
>>> pct = .345>>> value = 45500>>> f‘Price grew by {pct:.1%} or ${value:,}''Price grew by 34.5% or 45,500'
More information on the Python formatting language can be accessed via the official documentation (https://docs.python.org/3/library/string.html#formatspec).