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

 

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

posted @ 2017-08-30 23:41  捉老鹰的小鸡鸡  阅读(19986)  评论(2编辑  收藏  举报