I've tried format(x, "02.15f") but I only get trailing 0's not leading ones. I know that one solution would be to do something like:
#assuming x is a POSITIVE float
x = (2 - len(str(x).split(".")[0])) * "0" + format(x,".15f")
would get the leading 0's, but I know there must be a better way! Any suggestions?
This post has been edited by atraub: 27 November 2010 - 12:29 PM

New Topic/Question
Reply




MultiQuote



|