Day44 - 크롤링(2). 22.10.28.금

류소리·2022년 10월 28일
0

크롤링

목록 보기
4/5


->ㄴㄱㄷㄹㅁ


# 역대 대통령 이름 뽑아보기.
# (1)
from bs4 import BeautifulSoup
import requests 

# (2)
url="https://ko.wikipedia.org/wiki/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD%EC%9D%98_%EB%8C%80%ED%86%B5%EB%A0%B9_%EB%AA%A9%EB%A1%9D"

# (3)
html = requests.get(url)
soup=BeautifulSoup(html.text, 'html.parser')
 
# (4) 
title= soup.select('td > b > a')
for a in title :
    print(a.text)

out put:
이승만
윤보선
박정희
최규하
전두환
노태우
김영삼
김대중
노무현
이명박
박근혜
문재인
윤석열


#(3)
html = requests.get(url)
soup=BeautifulSoup(html.text, 'html.parser')

#(4)
title= soup.select('td > b > a')
for a in title :
print(a.text)



profile
새싹 빅테이터 개발자

0개의 댓글