Вы можете использовать next()
для поиска любых следующих элементов и для очистки text()
strip()
from bs4 import BeautifulSoup as soup
import requests
my_url='https://www.zoopla.co.uk/for-sale/property/london/west-wickham/?q=West%20Wickham%2C%20London&results_sort=newest_listings&search_source=home'
req = requests.get(my_url)
page_soup = soup(req.content,'html.parser')
containers = page_soup.findAll("div",{"class":"listing-results-wrapper"})
for c in containers:
a = c.find("a",{"class":"listing-results-price text-price"})
b = c.find("h3",{"class":"listing-results-attr"})
NoBedsx = b.find('span',{'class':'num-icon num-beds'})
NoBathsx = b.find('span',{'class':'num-icon num-baths'})
NoRecx = b.find('span',{'class':'num-icon num-reception'})
if a:
Price = a.next.strip().encode('utf-8')
if NoBedsx:
NoBeds = NoBedsx.next.next.encode('utf-8')
if NoBathsx:
NoBaths = NoBathsx.next.next.encode('utf-8')
if NoRecx:
NoRec = NoRecx.next.next.encode('utf-8')
print('{} {} {} {}'.format(Price,NoBeds,NoBaths,NoRec))
Вывод:
Price NoBeds NoBaths NoRec
£500,000 3 1 2
£337,500 4 2 1
£875,000 5 2 2
£695,000 4 1 2
£190,000 1 1 1
£670,000 4 2 1
£610,000 3 2 2
£675,000 4 2 1
£580,000 4 2 1
£850,000 5 2 1
£185,000 1 2 1
£760,000 5 2 1
£675,000 3 2 1
£142,000 1 2 1
£550,000 2 2 1
£817,000 4 2 1
£139,000 1 2 1
£625,000 3 1 2
£145,000 1 1 2
£725,000 4 1 2
£799,995 4 1 2
£575,000 3 1 2
£465,000 3 1 2
£725,000 4 2 2
£465,000 4 2 2