I am trying to use .format()
to format my output. I am trying to align the float to be centered, occupy a width of 12 and only display 2 decimal points.
I already have it working to be centered and occupy a width of 12 as follows:
print "{:^12}".format(dig)
However, how do I add the two decimal places format into this? I know it's .2f
, but how do I combine it all? I tried adding it after the 12, before the :
and at all sorts of places - it would always throw back an error.
Thanks!