Skip to content
Advertisement

BeautifulSoup how to only return class objects

I have a html document that looks similar to this:

JavaScript

So i have used this code but i am getting the first text from the tr that’s not a class, and i need to ignore it:

JavaScript

Also, when I try to do just a class, this doesn’t seem to be valid python:

JavaScript

I would like some help extracting the text.

Advertisement

Answer

To get the desired output, use a CSS Selector to exclude the first <tr> tag, and select the rest:

JavaScript

Output :

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