Pretty much what it says up there.
Basically, how do I get the string produced by
print "%05d" % 100
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
If you're using Python 3, the str.format method is preferred. It was introduced in Python 2.6. (Alas, my work system is at 2.4 (and I'm not permitted to upgrade), so I can't construct and test an example.)