from bs4 import BeautifulSoup
r=requests.get("***************")
soup = BeautifulSoup(r.content, "html.parser")
class=soup.find_all("div", class_="word")
At this rate, scraping will remain in the list surrounded by html tags.
I don't need tags, so I'd like to keep them in a list format with the tags removed.
python web-scraping beautifulsoup
If you only need text, you can do the following.
from bs4 import BeautifulSoup
import requests
r=requests.get("***************")
soup = BeautifulSoup(r.content, "html.parser")
wordclass=soup.find_all("div", class_="word")
wordlist = [x.text for x in wordclass ]
print(wordlist)
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.