功能: divmod()函数把除数和余数运算结果结合起来,返回一个包含商和余数的元组(a//b, a%b)
语法:divmod(a, b)
举例1.计算从参数N开始,向下递减的每一个数字和参数A的除数及余数的结果值...模拟实现数据分页计算方法。...','o', 'p', 'q', 'r', 's', 't','u','v', 'w', 'x', 'y', 'z']
startGet = (curIndex-1)*getSize
getData...getSize)
totalIndex = totalIndexTuple[0] + (1 if totalIndexTuple[1] > 0 else 0)
return (getData..., totalIndex)
调用getSegment()函数并传递当前页码和每页总条数参数,返回数据结果以及总的页码数,代码如下:
result = getSegment(2, 5)
print(result