Я не могу решить это l oop. Я хочу перебрать все страницы из URL и поместить все имена в таблицу. Есть 102 страницы. Заранее спасибо.
[from bs4 import BeautifulSoup
import re
import requests
url = "https://www.prokerala.com/kids/baby-names/hindu/"
r = requests.get(url)
soup = BeautifulSoup(r.content, "html.parser")
next_page = soup.find('a', {'class': 'next'}).get('href')
l=(f'{next_page}')
new_url=url+l
link=soup.find('span', {'class' : \['a name-details girl-names', 'a name-details boy-names'\] })
print("href='>%s'>%s</a>" % (link.get("href"), link.text))
while True:
r = requests.get(new_url)
soup = BeautifulSoup(r.content, "html.parser")
next_page = soup.find('a', {'class': 'next'}).get('href')
link=soup.find('span', {'class' : \['a name-details girl-names', 'a name-details boy-names'\] })
print("href='>%s'>%s</a>" % (link.get("href"), link.text))
l=(f'{next_page}')
new_url=url+l
if BeautifulSoup(r.content, "html.parser")is True:
break][1]
[1]: https://i.stack.imgur.com/SgM4I.png