Answer the question
In order to leave comments, you need to log in
How to do page flipping in flask?
how do i do this page flip?
in my web application, at the request of the user, the site is parsed and a list of links is sent, the list is very large and does not fit on the page. In general, how to place a paging on an html page to break one large list of 1000 links into small ones of 50?
and what is this block called in bootstrap?
Answer the question
In order to leave comments, you need to log in
To begin with, it would be nice to break this list into those very pages of 50.
If the list of links is passed as a list (meaning the data type), then you can do this:
def paginate(links: list, items_per_page: int) -> list:
"""
Эта функция разделяет список links на страницы по
items_per_page элементов на страницу. Возвращает список из списков.
Пример:
"""
pages = []
i = 0
j = 0
while i <= (len(links) - 1):
while j <= (len(links) - 1):
j = j + items_per_page
pages.append((links[i:j]))
i = i + items_per_page
return pages
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question