파이썬 BeautifulSoup4 html.parser VS lxml parser
IT/Python

파이썬 BeautifulSoup4 html.parser VS lxml parser

반응형

출처

Beautiful Soup Documentation(https://www.crummy.com/software/BeautifulSoup/bs4/doc/)

 

설치

pip install beautifulSoup4
pip install lxml

 

사용법

1.html.parser

import requests
from bs4 import BeautifulSoup as bs

URL = "http://kis6473.tistory.com"
html = requests.get(URL)
soup = bs(html.text, "html.parser")
print(soup)
 

2.lxml parser

import requests
from bs4 import BeautifulSoup as bs

URL = "http://kis6473.tistory.com"
html = requests.get(URL)
soup = bs(html.content, "lxml")
print(soup)
 
 
 
 
 
 
 
 
 
 

 

반응형