调整如下:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import ssl
context = ssl._create_unverified_context()
html = urlopen("http://en.wikipedia.org/wiki/Kevin_Bacon", context=context)
bsObj = BeautifulSoup(html,"lxml")
for link in bsObj.findAll("a"):
if 'href' in link.attrs:
print(link.attrs['href'])
网友评论