Python将数转换为带有千位分隔符的形式
在这篇文章中,我们使用Python将一个数转换为带有千位分隔符的形式;
实现代码
n = int(input('请输入一个数:'))
print("{:,}".format(n))
输出:
请输入一个数:1234567890 1,234,567,890
在这篇文章中,我们使用Python将一个数转换为带有千位分隔符的形式;
n = int(input('请输入一个数:'))
print("{:,}".format(n))
输出:
请输入一个数:1234567890 1,234,567,890
原创内容,如需转载,请注明出处;
本文地址: https://www.perfcode.com/p/number-with-commas-as-thousands-separators.html
关注微信公众号,免费向我提问;