- import urllib
- import BeautifulSoup
- htmlSource = urllib.urlopen("<a href="http://sebsauvage.net/index.html">http://sebsauvage.net/index.html").read(200000)
- soup = BeautifulSoup.BeautifulSoup(htmlSource)
- for item in soup.fetch('a'):
- print item['href']
- #该片段来自于http://www.codesnippet.cn/detail/100120131478.html
来源: http://www.codesnippet.cn/detail/100120131478.html