我想用python提取html中的段落。我使用了lxml模块,但它并不能完全满足我的需要。在
print html.parse(url).xpath('//p')[1].text_content()
<span id="midArticle_1"></span><p>Here is the First Paragraph.</p><span id="midArticle_2"></span><p>Here is the second Paragraph.</p><span id="midArticle_3"></span><p>Paragraph Three."</p>
我要补充的是,在不同的页数我有不同的段落数,所以想列一个列表,然后把段落放进去。在
输出
^{pr2}$相关问题 更多 >
编程相关推荐