I can parse the full argument of the html tag addressing it through a unix script shell as follows:
from bs4 import BeautifulSoup
soup = BeautifulSoup(open("test.html"))
print(soup(itemprop="name"))
where itemprop="name"uniquely identifies the desired tag.
the conclusion is similar to
[<span itemprop="name">
Blabla & Bloblo</span>]
Now I would like to return only a part Bla Bla Blo Blo.
my attempt was to do:
print(soup(itemprop="name").getText())
but I get an error like AttributeError: 'ResultSet' object has no attribute 'getText'
he worked experimentally in other contexts such as
print(soup.find('span').getText())
So am I mistaken?
source
share