本文介绍了将数字向下舍入到小数点后一位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的公式结果保留小数点后一位,但要四舍五入.有没有我可以添加打印的公式?也许有修剪?这也可以.

I want to get my result of a formula to be 1 decimal place but rounded down.Is there a formula I could add to print?Is there a trim perhaps? That could also work.

推荐答案

from math import floor
x = 8.64
x = floor(x*10)/10
print(x)

8.6

这篇关于将数字向下舍入到小数点后一位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 09:24