인프런 커뮤니티 질문&답변
import error
작성
·
372
0
--------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-2-6fe94347d1cd> in <module> 1 import urllib.request ----> 2 from bs4 import Beautifulsoup 3 4 url = 'https://search.naver.com/search.naver?where=view&sm=tab_jum&query=파이썬' 5 ImportError: cannot import name 'Beautifulsoup' from 'bs4' (/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bs4/__init__.py)
이런 에러가 뜨네요?? 어떻게 해야 되나요?
퀴즈
requests와 beautifulsoup 라이브러리는 웹 크롤링에서 주로 어떤 목적으로 함께 사용되나요?
웹 페이지에서 JavaScript를 실행하고 상호작용하기 위해
정적인 웹 페이지의 HTML을 가져와서 구조를 분석하기 위해
웹 서버에 데이터를 전송하고 응답을 처리하기 위해
데이터베이스에 크롤링 결과를 저장하기 위해
답변 1
0
jessie_12
질문자
html = 까지 했을 때는 이런 에러가 뜹니다.. 뭐가 문제일까요
UnicodeEncodeError: 'ascii' codec can't encode characters in position 46-48: ordinal not in range(128)
---------------------------------------------------------------------------UnicodeEncodeError Traceback (most recent call last)<ipython-input-9-41016efaec08> in <module> ----> 1 html = urllib.request.urlopen(url).read(url) /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context) 212 else: 213 opener = _opener --> 214 return opener.open(url, data, timeout) 215 216 def install_opener(opener):





