1 import re 2 import urllib 3 url="http://www.itokit.com" 4 s=urllib.urlopen(url).read() 5 ss=s.replace(" ","") 6 urls=re.findall(r"<a.*?href=.*?</a>",ss,re.I) 7 for i in urls: 8 print i 9 else: 10 print 'this is over'
挺好用的,记录下