How can I format a string like this
"%01.2f" % pr"%01.2f" % some_number
but using the str.format() style? I'm used to this:
'{0} {1}'.format(somev开发者_C百科alue1, somevalue2)
Is there a way to use that function style vs the old % style, and still achieve this decimal formatting?
It would be like {0:01.2f}
, I believe. See http://docs.python.org/library/string.html#format-string-syntax.
Edit: added in your zero-padding.
精彩评论