[Python] python通过BeautifulSoup分页网页中的超级链接 →→→→→进入此内容的聊天室

来自 , 2020-01-16, 写在 Python, 查看 125 次.
URL http://www.code666.cn/view/10a409f7
  1. from BeautifulSoup import BeautifulSoup
  2. import urllib2
  3. import re
  4.  
  5. url = urllib2.urlopen("http://www.sharejs.com")
  6. content = url.read()
  7. soup = BeautifulSoup(content)
  8. for a in soup.findAll('a',href=True):
  9.     if re.findall('sharejs', a['href']):
  10.         print "Found the URL:", a['href']
  11. #//python/8421

回复 "python通过BeautifulSoup分页网页中的超级链接"

这儿你可以回复上面这条便签

captcha