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)
© 2024 OneMinuteCode. All rights reserved.