python 四舍五入四舍五入就用round( )?Python四舍五入的正确打开方式!
强转int会向下取整int(2.9),结果为2四舍五入就用round( )?Python四舍五入的正确打开方式!round( )函数简介菜鸟教程中介绍到,round() 函数作用就是,返回浮点数x的四舍五入值。> round( x [, n] )参数x,n均为数值表达式,返回值为x的四舍五入值。n为保留的小数位数,不加n则只保留x四舍五入后的整数部分。>>> round(2.3)2>>> roun