#Python3#爬虫

2018-11-29  本文已影响1人  AlanSS

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)

上一篇 下一篇

猜你喜欢

热点阅读