python如何打印双精度浮点数后面的0

2025-04-05 19:53:25
推荐回答(1个)
回答1:

查看round函数,可以设置保留的小数点位数,例子:
print "round(80.23456, 2) : ", round(80.23456, 2)
print "round(100.000056, 3) : ", round(100.000056, 3)
print "round(-100.000056, 3) : ", round(-100.000056, 3)