     [Answers](https://scrapfly.io/blog)   /  [beautifulsoup](https://scrapfly.io/blog/tag/beautifulsoup)   /  [How to find elements without a specific attribute in BeautifulSoup?](https://scrapfly.io/blog/answers/how-to-find-elements-without-attribute-in-beautifulsoup)   # How to find elements without a specific attribute in BeautifulSoup?

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

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

 

 

Using Python and Beautifulsoup, to find elements without a specific attribute (like `class`) we can use `find` or `find_all` methods or [CSS selectors](https://scrapfly.io/blog/posts/parsing-html-with-css):

python```python
import bs4
soup = bs4.BeautifulSoup("""
<a class="ignore">bad link</a>
<a>good link</a>
""")

soup.find_all("a", class_=None)
["<a>good link</a>]
# or using a lambda function:
soup.find_all("a", class_=lambda value: "ignore" not in value)
# or using regular expression
soup.find_all("a", class_=re.compile(""))
```





 

    



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-elements-without-attribute-in-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-elements-without-attribute-in-beautifulsoup) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-elements-without-attribute-in-beautifulsoup) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-elements-without-attribute-in-beautifulsoup) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-elements-without-attribute-in-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 xpath 

### Ultimate XPath Cheatsheet for HTML Parsing in Web Scraping

Ultimate companion for HTML parsing using XPath selectors. This cheatsheet contains all syntax explanations with interac...

 

 ](https://scrapfly.io/blog/posts/xpath-cheatsheet) [  

 python data-parsing 

### Parsing HTML with Xpath

Introduction to xpath in the context of web-scraping. How to extract data from HTML documents using xpath, best practice...

 

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

  ## Related Questions

- [ Q How to find HTML elements by text value with BeautifulSoup ](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-text-with-beautifulsoup)
- [ Q How to find HTML elements by attribute using BeautifulSoup? ](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-attribute-with-beautifulsoup)
- [ Q How to select elements by text in XPath? ](https://scrapfly.io/blog/answers/how-to-select-elements-by-text-in-xpath)
- [ Q How to select elements by attribute value in XPath? ](https://scrapfly.io/blog/answers/how-to-select-elements-by-attribute-value)
 
  



   



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