from paginator import Paginator iterable = range(0, 100000) p = Paginator(iterable, page_size=6, step=1) print(len(p)) # Get total pages print(p.size) # Iterable length print(p[3]) # Iterator with the elements of page number 3 print( p[3:5:1] ) # Iterator with the elements from page 3 to page 5 with step 1 between elements p.reload() # Set the current page number to 0 print(p.has_next) # Check that there is a next page print(p.has_prev) # Check that there is a prev page print(p.next_page) # Iterator with the elements from next page print(p.prev_page) # Iterator with the elements from prev page print(p.current_page) # Iterator with the elements from current page for it in p: print(it) # Iterator with the elements of the page associated with <it>