发布网友
共1个回答
热心网友
方法一: 使用字符串格式化
a = 12.345
print("%.2f" % a)
12.35
方法二: 使用round内置函数
a = 12.345
round(a, 2)
12.35