Join TSR now and chat about whatever you’re intoSign up now

using beautiful soup to find_all multiple class names Watch

    • Thread Starter
    Offline

    2
    ReputationRep:
    I searched thoroughly for solution on many websites and on here but none of them works!I am trying to scrap flashscores.com and i want to parse a with the class name 'cell_ab team-home ' or 'cell_ab team-home bold '

    I tried using re

    Code:
    soup.find_all('td', { 'class'= re.compile(r"^(cell_ab team-home |cell_ab team-home  bold )$")
    )

    and

    Code:
    soap.find_all('td', { 'class' : ['cell_ab team-home ','cell_ab team-home  bold '])
    neither of them works.
    Offline

    3
    ReputationRep:
    According to the docs you should be doing something like this:
    Code:
    soup.find_all("td", class_=re.compile("cell_ab team-home | cell_ab team-home  bold"))
 
 
 
Write a reply… Reply
Submit reply
Updated: May 10, 2015
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Poll
How are you feeling about your A-level results?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.