按页或限制、偏移量列出分页
pagilist的Python项目详细描述
pagilist
使用页或限制/偏移量对列表分页的简单模块。源代码位于 Github。
使用量
page = 0 #first page limit = 3 #three items per page page_sample = paginate(list, page, limit) ##OR## offset = 3 #start from the fourth element on list page_offset = paginate_offset(list, offset, 5) #get from the fourth element with a limit of 5 elements print(page_sample) #outputs [1, 2, 3] print(page_offset) #outputs [4, 5, 6, 7, 8]