Given:
a = 1 b = 10 c = 100
How do I display a leading zero for all numbers with less than two digits?
This is the output I\'m expe
The Pythonic way to do this:
str(number).rjust(string_width, fill_char)
This way, the original string is returned unchanged if its length is greater than string_width. Example:
a = [1, 10, 100] for num in a: print str(num).rjust(2, '0')
Results:
01 10 100