Possible Duplicate:
Beautiful Soup cannot find a CSS class if the object has other classes, too
I'm using BeautifulSoup to find tables
in the HTML. The problem I am currently running into is the use of spaces in the class
attribute. If my HTML reads <html><table class="wikitable sortable">blah</table></html>
, I can't seem to extract it with the following (where I was to be able to find tables
with both wikipedia
and wikipedia sortable
for the class
):
BeautifulSoup(html).findAll(attrs={'class':re.compile("wikitable( sortable)?")})
This will find the table if my HTML is just <html><table class="wikitable">blah</table></html>
though. Likewise, I have tried using "wikitable sortable"
in my regular expression, and that won't match either. Any ideas?