Only show decimal point if floating point component is not .00 sprintf/printf June 11, 2023 by Tarik You want to use %g instead of %f: "%gx" % (factor / 100.00)