• 카테고리

    질문 & 답변
  • 세부 분야

    데이터 분석

  • 해결 여부

    미해결

br태그 정제

19.08.02 21:32 작성 조회수 105

0

from bs4 import BeautifulSoup

 

example1 = BeautifulSoup(train['review'][0], "html5lib")

print(train['review'][0][:700])

example1.get_text()[:700]

이 코드를 실행하려고 하는데 

 

File "<pyshell#69>", line 1, in <module>

    example1 = BeautifulSoup(train['review'][0], "html5lib")

  File "C:\Users\Ki-Sung Kim\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bs4\__init__.py", line 208, in __init__

    % ",".join(features))

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?

 

이런식으로 에러가 납니다. 어떻게 해결 해야 하나요...

답변 1

답변을 작성해보세요.

0

parser library에서 html5lib를 찾지 못하는 문제인데 cmd 등을 통해 install을 진행해도 인식하지 못하는 경우가 있습니다.

이 경우에는 pip install lxml을 진행하시고

example1 = BeautifulSoup(train['review'][0], lxml)
print(train['review'][0][:700])
example1.get_text()[:700]

을 진행하시면 되겠습니다.