0

I expected to find an easy answer for this, but for some reason I did not. I need to print a number with a thousands separator (dot) and a decimal separator (comma). For example: if the input is 10000, the output should be 10.000,00.

If tried:

>> locale.setlocale(locale.LC_ALL, 'pt_BR.UTF-8')
>> f'{num:,.2f}'
'10,000.00'
>> f'{num:n}'
'10.000'

And other variations, but I couldn't understand how to use the dot as the thousands separator and the comma as the decimal separator without using .replace(), for example.

Any suggestions?

filipebarretto
  • 1,842
  • 1
  • 13
  • 27

0 Answers0