python-整数截断(向上取整,向下取整)

209 阅读1分钟

import math math.floor(2.5) 2

math.floor(-2.5) -3

math.trunc(2.5) 2

math.trunc(-2.5) -2