import math

print (math.ceil(2.5))#向上取整
print (math.floor(2.5))#向下取整
print (round(2.5))#四舍五入

向上取整,向下取整,四舍五入

更多推荐

Python 取整函数(向上取整,向下取整,四舍五入)