x = 3.14159265
print(round(x, 2)) # 输出3.14
x = 3.14159265
# f 代表浮点数
print("{:.2f}".format(x)) # 输出3.14
x = 3.14159265
print("%.2f" % x) # 输出3.14
不推荐使用
from decimal import Decimal
x = 3.14159265
print(Decimal(x).quantize(Decimal('0.00')))