     [Answers](https://scrapfly.io/blog)   /  [beautifulsoup](https://scrapfly.io/blog/tag/beautifulsoup)   /  [How to find sibling HTML nodes using BeautifulSoup and Python?](https://scrapfly.io/blog/answers/how-to-find-siblings-nodes-with-beautifulsoup)   # How to find sibling HTML nodes using BeautifulSoup and Python?

 by [Bernardas Alisauskas](https://scrapfly.io/blog/author/bernardas) Oct 26, 2022 1 min read [\#beautifulsoup](https://scrapfly.io/blog/tag/beautifulsoup) [\#css-selectors](https://scrapfly.io/blog/tag/css-selectors) [\#data-parsing](https://scrapfly.io/blog/tag/data-parsing) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-siblings-nodes-with-beautifulsoup "Share on LinkedIn")    

 

 

When web scraping, sometimes it's easier to select a value by finding its sibling first. Using Python and Beautifulsoup, to find element siblings we can use `find()` and `find_all()` methods or [CSS selectors](https://scrapfly.io/blog/posts/parsing-html-with-css) and the `select()` method:

python```python
import bs4

soup = bs4.BeautifulSoup("""
<span class="price">Price including shipping:</span>
<span>83.13</span>
""")

# using find() method:
soup.find('span', class_="price").find_next_sibling('span').text
"83.13"

# using CSS selectors and `~` notation:
soup.select('.price ~ span')[0].text
# or
soup.select_one('.price ~ span').text
"83.13"
```





 

    



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-siblings-nodes-with-beautifulsoup) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-siblings-nodes-with-beautifulsoup) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-siblings-nodes-with-beautifulsoup) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-siblings-nodes-with-beautifulsoup) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-siblings-nodes-with-beautifulsoup) 



 ## Related Articles

 [  

 python data-parsing 

### How to Parse Web Data with Python and Beautifulsoup

Beautifulsoup is one the most popular libraries in web scraping. In this tutorial, we'll take a hand-on overview of how ...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-python-beautifulsoup) [  

 data-parsing css-selectors 

### Parsing HTML with CSS Selectors

Introduction to using CSS selectors to parse web-scraped content. Best practices, available tools and common challenges ...

 

 ](https://scrapfly.io/blog/posts/parsing-html-with-css) [     

 data-parsing css-selectors 

### Ultimate CSS Selector Cheatsheet for Web Scraping and HTML Parsing

CSS selectors is a powerful HTML querying protocol which is used by browsers to determine what HTML elements to style. I...

 

 ](https://scrapfly.io/blog/posts/css-selector-cheatsheet) 

  ## Related Questions

- [ Q How to select values between two nodes in BeautifulSoup and Python? ](https://scrapfly.io/blog/answers/how-to-select-values-between-two-elements-in-beautifulsoup)
- [ Q How to find HTML elements by class? ](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-class)
- [ Q How to find HTML elements by multiple tags with BeautifulSoup? ](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-multiple-tags-with-beautifulsoup)
- [ Q How to find HTML element by class with BeautifulSoup? ](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-class-with-beautifulsoup)
 
  



   



 Extract structured data with AI, **1,000 free credits** [Start Free](https://scrapfly.io/register)