fstring format decimal points code example
Example 1: f string float format
>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'
Example 2: f string decimal places
>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'
>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'
>>> a = 10.1234
>>> f'{a:.2f}'
'10.12'