如何从这样的页面中提取段落? https://www.sec.gov/Archives/edgar/data/81318/000165495416004006/yuma_10q.htm
我试着得到文本:
from bs4 import BeautifulSoup
import re, requests
link='https://www.sec.gov/Archives/edgar/data/81318/000165495416004006/yuma_10q.htm'
html=BeautifulSoup(requests.get(link).content,'html.parser')
text = ' '.join([s for s in html.strings if s.parent.name not in ('style', 'script', 'head', 'title', 'meta', '[document]')])
print(text)
然而,它是非常混乱和一些不同的段落连接在一起没有任何一致的模式,他们应该如何分开。有没有一个更干净的解决方案来从中有组织地抓取文本
目前没有回答
相关问题 更多 >
编程相关推荐