在 Python 中,如何一次执行多种格式:
所以我想让一个数字没有小数位并且有一个千位分隔符:
数量 = 80000.00
我希望它是 80,000
我知道我可以单独做这两件事,但我将如何将它们结合起来:
"{:,}".format(num) # this will give me the thousands separator
"{0:.0f}".format(num) # this will give me only two decimal places
那么可以将这些结合在一起吗?