How can I format a float so that it doesn\'t contain trailing zeros? In other words, I want the resulting string to be as short as possible.
For example:
<
Handling %f and you should put
%.2f
, where: .2f == .00 floats.
Example:
print "Price: %.2f" % prices[product]
Price: 1.50