formatting long numbers as strings in python

后端 未结 9 2508
轻奢々
轻奢々 2020-11-28 07:00

What is an easy way in Python to format integers into strings representing thousands with K, and millions with M, and leaving just couple digits after comma?

I\'d li

9条回答
  •  没有蜡笔的小新
    2020-11-28 07:39

    No String Formatting Operator, according to the docs. I've never heard of such a thing, so you may have to roll your own, as you suggest.

提交回复
热议问题