formatting long numbers as strings in python

后端 未结 9 2473
轻奢々
轻奢々 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条回答
  •  -上瘾入骨i
    2020-11-28 07:38

    I don't know of any built-in capability like this, but here are a couple of list threads that may help:

    http://coding.derkeiler.com/Archive/Python/comp.lang.python/2005-09/msg03327.html http://mail.python.org/pipermail/python-list/2008-August/503417.html

提交回复
热议问题