用python正则表达式提取网页的url

http://edu.codepub.com/2010/0429/22416.php

 

import
 re
import urllib
url="http://www.itokit.com"
s=urllib.urlopen(url).read()
ss=s.replace(" " ,"" )
urls=re.findall(r"<a.*?href=.*?<\/a>" ,ss,re.I)
for i in urls:
print i
else :
print 'this is over'

你可能感兴趣的:(PHP,正则表达式,python)