I'd like to convert a number like 1323.67 to 1.323,67, how can I do that?
I've tried this
f'{1325.76:.,2f}'
but it prints out 1,325.76
I excpected f'{1325.76:.,2f}'
to be 1.325,75 but it's 1,325.76
I'd like to convert a number like 1323.67 to 1.323,67, how can I do that?
I've tried this
f'{1325.76:.,2f}'
but it prints out 1,325.76
I excpected f'{1325.76:.,2f}'
to be 1.325,75 but it's 1,325.76
If you can use external modules, I would suggest you to use babel
>>> from babel.numbers import format_decimal
>>> format_decimal(1323.67, locale='de_DE')
'1.323,67'
The format is
f'{1325.76:,.2f}'
and not
f'{1325.76:.,2f}'
:,.2f
is what you want. Which means ,
as separator with 2 decimal positions.