Python 2 lugares decimais
print(format(432.456, ".2f"))
>> 432.45
print(format(321,".2f"))
>> 321.00
Wild Weasel
print(format(432.456, ".2f"))
>> 432.45
print(format(321,".2f"))
>> 321.00
>>>pi=3.141592653589793238
>>> float("{:.12}".format(pi))
3.14159265359
>>> float("{:.6}".format(pi))
3.14159
a_float = 3.14159
formatted_float = "{:.2f}".format(a_float)
print(formatted_float)