Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python beautifulsoup get content of tag

from bs4 import BeautifulSoup

soup = BeautifulSoup(file, "lxml")
content_tag = soup.find("tag", {"class": "tag_class"}).text


""" another option """
from bs4 import BeautifulSoup
import requests

link = requests.get(link)
soup = BeautifulSoup(link, "lxml")
content_tag = soup.findall("a", {"class": "tag_class"}).get("href")
 
PREVIOUS NEXT
Tagged: #python #beautifulsoup #content #tag
ADD COMMENT
Topic
Name
1+5 =