- import urllib
- htmlSource = urllib.urlopen("<a href="http://www.CodeSnippet.Cn">http://www.CodeSnippet.Cn").read(200000)
- for chunk in htmlSource.lower().split('href=')[1:]:
- indexes = [i for i in [chunk.find('"',1),chunk.find('>'),chunk.find(' ')] if i>-1]
- print chunk[:min(indexes)]
- #该片段来自于http://www.codesnippet.cn/detail/100120131485.html
来源: http://www.codesnippet.cn/detail/100120131485.html