阅读背景:

【python】获取指定网页上的所有超级链接

来源:互联网 
# -*- coding: utf-8 -*-
import urllib2
import re

#connect to a URL
website = urllib2.urlopen("https://www.baidu.com")
#read html code
html = website.read()
#use re.findall to get all the links
links = re.findall('"((http|ftp)s?://.*?)"', html)  ###".*?"任意匹配
print links
# -*- coding: utf-8 -*-
import urllib2
impo



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: