Fixed digits after decimal with f-strings September 8, 2022 by Tarik Include the type specifier in your format expression: >>> a = 10.1234 >>> f'{a:.2f}' '10.12'