开始采集
1、获取维基百科的页面
#研究凯文到埃里克的链条主题长度 from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("http://en.wikipedia.org/wiki/Kevin_Bacon") bs = BeautifulSoup(html) for link in bs.findAll("a"):#字符a是标签 if "href" in link.attrs:#href是属性 print(link.attrs["href"])#打印属性里的内容
                    
                
                
            
        
浙公网安备 33010602011771号