파이썬에서 웹 크롤링을 하기 위해서 아래 패키지를 설치한다.
requests / beautifulsouo4
설치방법
pip install requests beautifulsoup4
웹 문서 전체 출력하기
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("www.naver.com")
bsObject = BeautifulSoup(html, "html.parser")
print(bsObject)
[출처]
https://webnautes.tistory.com/779?category=618796
'파이썬' 카테고리의 다른 글
XPATH 사용하기 (0) | 2019.10.16 |
---|