962148150 发表于 2015-4-28 07:42:51

python的round函数使用

  
碰到的问题: 对float进行精确两位显示出来。
解决的方法:round(3.32342,2)#3.32.
round函数概念:
  英文:圆,四舍五入
是python内置函数,它在哪都能用,对数字取四舍五入。
round(number[, ndigits])
round 对传入的数据进行四舍五入,如果ngigits不传,默认是0(就是说保留整数部分).ngigits
页: [1]
查看完整版本: python的round函数使用