Learn Before
Code
BeautifulSoup Tag: text
The text attribute of a BeautifulSoup Tag returns the text of the tag as a string.
from bs4 import BeautifulSoup soup = BeautifulSoup('<ex class="example">\ This is an example</ex>', 'html.parser') tag = soup.ex # <ex class='example'>This is an example</ex> tag.text # 'This is an example'
0
1
Updated 2021-02-08
Tags
Python Programming Language
Data Science