I'm writing a method to generated a latex table table from input arrays. It's working but there is one nuisance: I want trailing zeros on numbers. Right now I'm using the %g method which works nicely, but it still will turn 1.340 into 1.34 if I do "%.4g" % 1.340. Is there any python method that anyone knows of that will keep trailing zeros out to a given decimal place? Any ticks I can do to format the numbers this way and just use %s?