简体   繁体   中英

BeautifulSoup Soup findall extract only the class data

I want to just extract the data in the class line between the< > tags, the html line is:

[<h4 class="jobsearch-CompanyReview--heading">ABC</h4>]

I am using this code, but it's returning the compete line and I just want the ABC part of the string.

company = soup.find_all("h4", class_ ="jobsearch-CompanyReview--heading")

How can I just remove the data form the html string?

company = soup.find_all("h4", class_ ="jobsearch-CompanyReview--heading")[0].text

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM