reference http://python.civic-apps.com/string-format-function/
151125d.py
print "{0:0>3}".format(8)
Run
[toLearn]$ python 151125d.py
008
@ shiracamus's Comment taught me various ways of writing.
I added it to the title so that it can be found by searching.
Recommended Posts