Python中千位分隔符的格式说明符

时间:2017-11-29 01:28:03

标签: python-3.x

我遇到过这种格式说明符https://docs.python.org/dev/whatsnew/2.7.html#pep-378-format-specifier-for-thousands-separator-格式化整数时,请在宽度后面加逗号:

>>> '{:20,d}'.format(18446744073709551616)
'18,446,744,073,709,551,616'

我不明白为什么宽度在这里给出为20。我尝试使用相同的10

>>> '{:10,d}'.format(18446744073709551616)
'18,446,744,073,709,551,616'

任何解释都会有很大的帮助。 提前谢谢。

0 个答案:

没有答案
相关问题