美文网首页
#Python3#爬虫

#Python3#爬虫

作者: AlanSS | 来源:发表于2018-11-29 18:21 被阅读1次

import requests

r = requests.get('http://www.wise.xmu.edu.cn/people/faculty?ListBy=IndexLetter')

html = r.content

from bs4 import BeautifulSoup

soup = BeautifulSoup(html, 'html.parser')

div_people_list = soup.find('div', attrs={'class': 'people_list'})

a_s = div_people_list.find_all('a', attrs={'target': '_blank'})

for a in a_s:

    url = a['href']

    name = a.get_text()

    print(name, url)

相关文章

网友评论

      本文标题:#Python3#爬虫

      本文链接:https://www.haomeiwen.com/subject/ftdfcqtx.html