How can I print a float with thousands separators?

后端 未结 3 905
南旧
南旧 2021-01-01 12:38

How can I format a decimal number so that 32757121.33 will display as 32.757.121,33?

3条回答
  •  孤城傲影
    2021-01-01 13:35

    I have found another solution:

    '{:,.2f}'.format(num).replace(".","%").replace(",",".").replace("%",",")
    

提交回复
热议问题