Python: How to convert an int into its string with a defined number of digits?

advertisements

Pretty much what it says up there.

Basically, how do I get the string produced by

print "%05d" % 100


Maybe I'm misinterpreting the question, but this should work:

my_string = "%05d" % 100