python format string thousand separator with spaces

后端 未结 5 1524
悲哀的现实
悲哀的现实 2020-12-02 17:51

For printing number with thousand separator, one can use the python format string :

\'{:,}\'.format(1234567890)

But how can I specify that

5条回答
  •  星月不相逢
    2020-12-02 18:33

    Here is bad but simple solution if you don't want to mess with locale:

    '{:,}'.format(1234567890.001).replace(',', ' ')
    

提交回复
热议问题