import math f = 11.2 print math.ceil(f) #向上取整 print math.floor(f) #向下取整 print round(f) #四舍五入 #这三个函数的返回结果都是浮点型
Python向上取整,向下取整以及四舍五入函数
原文:https://www.cnblogs.com/hankleo/p/10475756.html