# int 向0取整
int(-0.5) # 0
int(0.5) # 0


# round四舍五入,向偶取整
round(0.5) # 0
round(0.9) # 1
round(1.5) # 2


import math

# math.floor 向下取整
math.floor(0.9) # 0
math.floor(-0.9) # -1


# math.ceil 向上取整
math.ceil(0.5) # 1
math.ceil(-0.5) # 0


参考 ​​Python取整——向上取整、向下取整、四舍五入取整、向0取整​