使用 Beautiful Soup 模块,如何获取div
类名为的标签的数据feeditemcontent cxfeeditemcontent
?是吗:
soup.class['feeditemcontent cxfeeditemcontent']
或者:
soup.find_all('class')
这是 HTML 源代码:
<div class="feeditemcontent cxfeeditemcontent">
<div class="feeditembodyandfooter">
<div class="feeditembody">
<span>The actual data is some where here</span>
</div>
</div>
</div>
这是Python代码:
from BeautifulSoup import BeautifulSoup
html_doc = open('home.jsp.html', 'r')
soup = BeautifulSoup(html_doc)
class="feeditemcontent cxfeeditemcontent"