浮点数保留n位小数

p = 1.234
p = round(p,2) 
print(p) # 1.23

#round(你要操作的数,保留几位)

猜你喜欢

转载自www.cnblogs.com/liangying666/p/9161711.html