【发布时间】:2016-06-28 05:13:28
【问题描述】:
我在获取段落标签的内容时有点困惑。
<div class="SomeID">
<p>What a voice! </p>
</div>
我到了这一点
list = soup.find_all("div","SomeID")
但是如何获取段落内容。(好声音!)
基本问题是从
中获取所有段落标签的内容import urllib
from bs4 import BeautifulSoup
html = urllib.urlopen('http://www.dawn.com/news/1267272/democracys-woes').read()
soup = BeautifulSoup(html, 'html.parser')
list = soup.find_all("div","comment__body cf")
print list
【问题讨论】:
标签: python python-2.7 beautifulsoup pydev