sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频)
# -*- coding: utf-8 -*- """ Created on Sun Dec 24 20:49:39 2017 @author: Administrator """ import requests,bs4,re url="http://www.klm123.com/channel/74" begin="http://www.klm123.com" def getLinks(url): res = requests.get(url) soup = bs4.BeautifulSoup(res.text,"lxml") links = [] for link in soup.findAll('a', attrs={'href': re.compile("^/video/")}): links.append(begin+link.get('href')) return links list_links=getLinks(url) print( getLinks(url) )