向下取整
math.floor(num)
向上取整
math.ceil(num)
取整取余
math.modf(num)
测试
num = 12.4
print(math.floor(num)) 12
print(math.ceil(num)) 13
integer, decimal = math.modf(num)
print(integer) 12
print(decimal) 0.4
math.floor(num)
math.ceil(num)
math.modf(num)
num = 12.4
print(math.floor(num)) 12
print(math.ceil(num)) 13
integer, decimal = math.modf(num)
print(integer) 12
print(decimal) 0.4