Answer the question
In order to leave comments, you need to log in
Parsing text in python. How to display only lines that contain a certain word?
I've parsed text from jobs and descriptions, and now I need to output lines that, for example, only contain the word "php".
Is it possible to do this in a Parsing request? Or only date the frame needs to be filtered by a cycle.
Code example:
num_of_page = 20
job_elements = []
for i in range(num_of_page):
URL ="https://career.habr.com/vacancies?divisions[]=frontend&page=" + str(i+1)+ "&type=all"
page = requests.get(URL)
soup = bs(r.text, "html.parser")
vacancies_names = soup.find_all('a', class_='vacancy-card__title-link')
for name in vacancies_names:
job_elements.append(name.get_text())
job_elements=pd.DataFrame(job_elements)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question