标签:log 小数点 pre pytho 5.0 bsp 4.0 blog git
利用round(number[, ndigit] )函数四舍五入
保留浮点数的小数点。 如保留小数点后两位。 num = 9.2174 new_num = round( num , 2 ) 则new_num = 9.22 (四舍五入)
>>> num = 4.93 >>> num 4.93 >>> new_num = round(num,0) >>> new_num 5.0 >>> num = 4.49 >>> new_num = round(num,0) >>> new_num 4.0 >>> new_num = round(num,0)
标签:log 小数点 pre pytho 5.0 bsp 4.0 blog git
原文地址:http://www.cnblogs.com/shenckicc/p/6938571.html