python - Fixed digits after decimal with f-strings - Stack Overflow

PHOTO EMBED

Tue Dec 14 2021 09:03:20 GMT+0000 (Coordinated Universal Time)

Saved by [deleted user]

>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'
content_copyCOPY

https://stackoverflow.com/questions/45310254/fixed-digits-after-decimal-with-f-strings