[Tutor] makeing '1' into a '01' neatly ?

Dave S pythontut at pusspaws.net
Wed Apr 28 06:09:24 EDT 2004

I need strings of the form 01, 02, 03 ... ,10,11,12 ... for archiving files.

Is there an neat way to format a '1' into a '01' ?

I felt sure string methods or string formatting would help, but alas no.
I could add an if statement to add a 0 but this seems awkward & I am 
sure there is a better way.

Any ideas


More information about the Tutor mailing list