Using Beautiful Soup module, how can I get data of a div
tag whose class name is feeditemcontent cxfeeditemcontent
? Is it:
soup.cla
Check this bug report: https://bugs.launchpad.net/beautifulsoup/+bug/410304
As you can see, Beautiful soup can not really understand class="a b"
as two classes a
and b
.
However, as it appears in the first comment there, a simple regexp should suffice. In your case:
soup = BeautifulSoup(html_doc)
for x in soup.findAll("div",{"class":re.compile(r"\bfeeditemcontent\b")}):
print "result: ",x
Note: That has been fixed in the recent beta. I haven't gone through the docs of the recent versions, may be you could do that. Or if you want to get it working using the older version, you could use the above.