优茬娱乐网
您的当前位置:首页python如何保留一位小数

python如何保留一位小数

来源:优茬娱乐网


方法1

用round函数

例如:

a=12.345678
round(a,1)=12.3 保留一位小数
round(a,2)=12.35 保留二位小数
显示全文