python中如何实现向上取整

山城小跳 / 2023-06-09 / 原文

方式一

import math
total_page_count = math.ceil(10/4)   #  3

方式二

# total_page_count, div = divmod(total_count, page_size)
    # if div:
    #     total_page_count += 1