Formatting Numbers : float format « Data Type « Python Tutorial






print "Today's stock price: %f" % 50.462, 5 
print "Today's stock price: %.2f" % 50.4625     
print "Change since yesterday: %+.2f" % 1.5








2.5.float format
2.5.1.formatting float number, use the f specifier and supply the precision as a . (dot) followed by the number of decimals
2.5.2.Formatting Numbers
2.5.3.Floating Point and Exponential Notation Output
2.5.4.format float numbers