版权声明:本文为博主原创文章,转载请附上博文链接 https://blog.csdn.net/weixin_44065501/article/details/89346178
有时候,我们需要获取网站的全部url,用作于其他测试
以sogoWeChat为例:
import re
import urllib.request
response = urllib.request.urlopen("https://weixin.sogou.com/")
html = response.read()
tag = re.findall(r'<a href="([a-zA-z]+://[^\s]*)"', str(html))
print(tag)
推荐一个正则表达式在线验证网站:http://tool.oschina.net/regex/#