Невозможно очистить определенные текстовые элементы в html. ⇐ Python
-
Anonymous
Невозможно очистить определенные текстовые элементы в html.
I've been trying to web scrape certain text data using Beautiful Soup but it appears I can't access the text due to its formatting within the HTML code.
#1 '#' '1' The text I want is the '1'.
import requests from bs4 import BeautifulSoup def position_in_top(url): r = requests.get(url) soup = BeautifulSoup(r.content, 'html.parser') results = soup.find(id='main') job_title = results.find_all(class_ ='Text__TextElement-sc-if376j-0 gYdBJW encore-text-title-small') return job_title This is the code I have been using to try and access it. The function returns all the instances of this class but it doesn't include the '#' or the '1' I want.
Источник: https://stackoverflow.com/questions/781 ... ts-in-html
I've been trying to web scrape certain text data using Beautiful Soup but it appears I can't access the text due to its formatting within the HTML code.
#1 '#' '1' The text I want is the '1'.
import requests from bs4 import BeautifulSoup def position_in_top(url): r = requests.get(url) soup = BeautifulSoup(r.content, 'html.parser') results = soup.find(id='main') job_title = results.find_all(class_ ='Text__TextElement-sc-if376j-0 gYdBJW encore-text-title-small') return job_title This is the code I have been using to try and access it. The function returns all the instances of this class but it doesn't include the '#' or the '1' I want.
Источник: https://stackoverflow.com/questions/781 ... ts-in-html