Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Задача 6 (4 балла)
- def get_languages_hse(last_name):
- def get_teacher_url(last_name):
- url = 'https://www.hse.ru/org/hse/ouk/hmat/persons'
- import bs4
- import urllib.request
- try:
- f = urllib.request.urlopen(url)
- soup = bs4.BeautifulSoup(f.read(), "html.parser")
- s = None
- for a in soup.find_all(['a'], {'class': 'fa-person__name'}):
- if last_name in a.text:
- return 'http://' + a['href'][2:]
- except:
- return None
- # coding=utf8
- url = get_teacher_url(last_name)
- import bs4
- import urllib.request
- res = []
- try:
- f = urllib.request.urlopen(url)
- soup = bs4.BeautifulSoup(f.read(), "html.parser")
- for a in soup.find_all(['dl'],{'class':'main-list large main-list-language-knowledge-level'}):
- for r in a.find_all('dd'):
- res.append(r.text)
- return res
- except:
- pass
Advertisement
Add Comment
Please, Sign In to add comment