python 中str format 格式化数字补0方法

 

>>> "{0:03d}".format(1)
'001'
>>> "{0:03d}".format(10)
'010'
>>> "{0:03d}".format(100)
'100'

原文地址:https://www.cnblogs.com/sthinker/p/7456034.html