>>>pi=3.141592653589793238
>>> float("{:.12}".format(pi))
3.14159265359
>>> float("{:.6}".format(pi))
3.14159
x = 13.949999999999999999
g = float("{:.2f}".format(x))
from decimal import *
getcontext().prec = 10
a_float = 3.14159
formatted_float = "{:.2f}".format(a_float)
print(formatted_float)