1
我正在抓取一个网站,然后试图拆分成段落。通过查看被刮掉的文本,我可以清楚地看到一些段落分隔符没有被正确拆分。请参阅下面的代码来重新创建问题!BeautifulSoup解析器没有按标签正确分割
from bs4 import BeautifulSoup
import requests
link = "http://www.presidency.ucsb.edu/ws/index.php?pid=111395"
response = requests.get(link)
soup = BeautifulSoup(response.content, 'html.parser')
paras = soup.findAll('p')
# Note that in printing the below, there are still a lot of "<p>" in that paragraph :(
print paras[614]
我尝试过使用其他解析器 - 类似的问题。
不行的,不幸的是(或者LXML或使用response.text) 。感谢您的建议! – Craig