我有一个网页保存为.htm。基本上,有6层div需要解析并从中获取特定数据,我很困惑如何处理这一点。我试过不同的方法,但都没用。在
HTM文件有一堆标记,但有一个div如下所示:
<div id="fbbuzzresult" class.....>
<div class="postbuzz"> .... </div>
<div class="linkbuzz">...</div>
<div class="descriptionbuzz">...</div>
<div class="metabuzz>
<div class="time">...</div>
<div>
<div class="postbuzz"> .... </div>
<div class="postbuzz"> .... </div>
<div class="postbuzz"> .... </div>
</div>
我正在试着美容。更多的背景。。。在
我需要在每个postbush div中提取并打印上面显示的每一个内容
非常感谢您对一些框架代码的帮助和指导! P、 S-忽略div类中的破折号。 谢谢!在
您应该能够以与您的父项相同的方式使用结果
soup
:但在这样做之前,我遇到了一些错误,因此作为第二种方法,您可以做一种
^{pr2}$sub_soup
:首先阅读BeautifulSoup文档http://www.crummy.com/software/BeautifulSoup/bs4/doc/
第二,这里有一个小例子可以让你走得更远:
相关问题 更多 >
编程相关推荐