如何使用Beautiful Soup查找带有特定文本的href链接?

2024-04-25 15:27:43 发布

您现在位置:Python中文网/ 问答频道 /正文

page = urllib2.urlopen('https://www.sec.gov/Archives/edgar/data/1591890/0001493152-18-003887-index.htm').read()
soup = BeautifulSoup(page)
soup.prettify()
# page = requests.get('https://www.sec.gov/Archives/edgar/data/1591890/0001493152-18-003887-index.htm')

# soup = BeautifulSoup(page, 'html.parser')
# Remove bottom links


for link in soup.findAll('a', href=True,text = re.compile('instance')):
    print link['href']

我没有得到任何运行此链接


Tags: httpsdataindexwwwpagelinksecurllib2