Mega Code Archive

 
Categories / Python Tutorial / Data Type
 

Formatting Numbers

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