import requests
from bs4 import BeautifulSoup
url = "https://toss.im/"
res = requests.get(url)
res.raise_for_status
soup = BeautifulSoup(res.text, "lxml")
toss = soup.find("li", attrs={"class":"p-navbar__item"})
print(toss.find_next_siblings("li"))
Do you know how to print out only text from this code?
print(toss.find_next_siblings("li").get_text())
but it doesn't work.
I don't know why you convert the html page to lxml.
import requests
from bs4 import BeautifulSoup
url = "https://toss.im/"
res = requests.get(url)
soup = BeautifulSoup(res.text, "html.parser")
print(soup.select_one('li'))
709 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
549 PHP ssh2_scp_send fails to send files as intended
537 Uncaught (inpromise) Error on Electron: An object could not be cloned
548 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.