In Python, how do I specify a format when converting int to string?
More precisely, I want my format to add leading zeros to have a string with constant length. For
Try formatted string printing:
print "%04d" % 1 Outputs 0001
print "%04d" % 1