I have an integer representing a price in cents. Using Python format strings, how can I convert this value into dollars with two decimal places? Examples:
Using str.format:
for i in (1234,5,999): print('{:.2f}'.format(i/100.))
yields
12.34 0.05 9.99
In Python2.6 use '{0:.2f}' instead of '{:.2f}'.
'{0:.2f}'
'{:.2f}'