Answers for "python beautifulsoup get content of tag"

0

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")
Posted by: Guest on April-18-2022

Code answers related to "python beautifulsoup get content of tag"

Python Answers by Framework

Browse Popular Code Answers by Language