"뷰티플 수프"의 두 판 사이의 차이

5번째 줄: 5번째 줄:


[[파일:bs4-doc-image-6.1.jpg]]
[[파일:bs4-doc-image-6.1.jpg]]


<source lang='python'>
<source lang='python'>

2019년 12월 11일 (수) 23:21 판

1 개요

Beautiful Soup
뷰티풀 수프
  • HTML과 XML 문서를 파싱하는 파이썬 패키지

Bs4-doc-image-6.1.jpg

from bs4 import BeautifulSoup
from urllib.request import urlopen

with urlopen('https://en.wikipedia.org/wiki/Main_Page') as response:
    soup = BeautifulSoup(response, 'html.parser')
    for anchor in soup.find_all('a'):
        print(anchor.get('href', '/'))

2 같이 보기

3 참고