>>> 'number is : {:03.2f}'.format(2) 'number is : 2.00' >>> 'number is : {:03.2f}'.format(2.3555) 'number is : 2.36' >>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always '+3.140000; -3.140000' >>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers ' 3.140000; -3.140000' >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:f}; {:f}' '3.140000; -3.140000' "b" : Binary format. "c" : Character. "d" : Decimal Integer. "e" : Exponent notation. "E" : Exponent notation, upper case 'E'. "f" : Fixed point "F" : Fixed point. Same as 'f'. "g" : General format. "G" : General format, switches to 'E' if the number gets too large. The representations of infinity and NaN are uppercased, too. "n" : Number. This is the same as 'g', except that it uses the current locale setting to insert the appropriate number separator characters. "o" : Octal format. "s" : String format. "x" : Hex format, using lower- case letters for the digits above 9. "X" : Hex format, using upper- case letters for the digits above 9. "%" : Percentage. None : Thesame as 'g'.