【发布时间】:2019-05-22 15:03:42
【问题描述】:
我正在尝试提取此网页的链接:https://search.cisco.com/search?query=iot
使用此代码我没有得到任何返回:
# Get Html Data from webpage
html = urllib.request.urlopen(url, context=ctx).read()
soup = BeautifulSoup(html, 'html5lib')
# Retrieve all of the anchor tags
tags = soup('a') for tag in tags:
print(tag.get('href'))
我尝试了find_all() 方法,但遇到了同样的问题。
【问题讨论】:
-
请提供你得到的输出。
-
循环语句的格式是否有原因。我觉得这很奇怪。
-
@ottovon 我什么也没得到。循环语句很好。我只是不太干净地应对stackoverflow
标签: html python-3.x web-scraping beautifulsoup