format to two decimal places python alwys code example Example 1: python 2 decimal places format print "%.2f" % 5 Example 2: python 2 decimal places format "{:.2f}".format(5)