Answer the question
In order to leave comments, you need to log in
Why displays paragraphs with the word?
import requests
from bs4 import BeautifulSoup
a = 0
dollar_rub = 'https://www.avito.ru/rostovskaya_oblast?localPriority=0&q=Квартира'
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.85 YaBrowser/21.11.4.730 Yowser/2.5 Safari/537.36'}
full = requests.get(dollar_rub, headers=headers)
soup = BeautifulSoup(full.content, 'html.parser')
convert = soup.findAll("span", {"class": "price-text-E1Y7h text-text-LurtD text-size-s-BxGpL"})
for i in convert:
if 'месяц' not in i:
print(convert[convert.index(i)].text)
Answer the question
In order to leave comments, you need to log in
Because i is not a drain, but bs4.element.Tag.
Try like this:
if 'месяц' not in i.text:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question