Skip to content
Advertisement

BeautifulSoup finds an html element that contains spaces in its attributes

How to use BeautifulSoup to find an html element that contains spaces in its attributes

JavaScript

I would like to know how to use soup.find to find the title that i want.
Because beautifulsoup considers the attribute attrs of title 'that i want' like this: {'class': ['td', 'p1']}.<br>

But not like this: {'class': ['td p1']}

Advertisement

Answer

Note Different approaches but both have in common to select the classes explicitly.

find()
JavaScript
select_one()
JavaScript

Example

JavaScript

Output

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement