Blog Content
Python之math向上取整、向下取整以及四舍五入函数
Python
2010-06-17 21:02:32
import math
f = 11.2
print math.ceil(f) #向上取整
print math.floor(f) #向下取整
print round(f) #四舍五入
#这三个函数的返回结果都是浮点型
上一篇:python遍历字典并修改,错误:dictionary changed size during iteration
下一篇:使用BatchPreparedStatementSetter 完成批量插入数据的操作