

python通过BeautifulSoup分页网页中的超级链接,这段python代码输出www.bitsCN.com主页上所有包含了jb51的url链接
from BeautifulSoup import BeautifulSoup
import urllib2
import re
url = urllib2.urlopen("http://www.bitsCN.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']希望本文所述对大家的Python程序设计有所帮助。
