python通过BeautifulSoup分页网页中的超级链接,这段python代码输出www.75271.com主页上所有包含了sharejs的url链接
from BeautifulSoup import BeautifulSoup import urllib2 import re url = urllib2.urlopen("http://www.75271.com") content = url.read() soup = BeautifulSoup(content) for a in soup.findAll('a',href=True): if re.findall('sharejs', a['href']): print "Found the URL:", a['href']