Python String Format Precision of Float
You can use string interpolation in combination with a dictionary for simple formatting.
print "My name is %(name)s and I have $%(change)0.2f in change in my pocket!" % { 'name': 'Sean', 'change': 00.23 }
# My name is Sean and I have $0.23 in chang...
Written by Sean Behan on 11/20/2013