python使用正则表达式提取网页URL的方法 本文实例讲述了python使用正则表达式提取网页URL的方法。分享给大家供大家参考。具体实现方法如下: import re import urllib url="//www.zwyuanma.com" s=urllib.urlopen(url).read() ss=s.replace(" ","") urls=re.findall(r"",ss,re.I) for i in urls: print i else: print 'this is over' PS:这里再为大家提供2款非常方便的正则表达式工具供大家参考使用: JavaScript正则表达式在线测试工具: http://tools.zwyuanma.com/regex/javascript 正则表达式在线生成工具: http://tools.zwyuanma.com/regex/create_reg 希望本文所述对大家的Python程序设计有所帮助。