Traceback (most recent call last):
File "c:\Users\user.DESKTOP-3NN2QR0\Desktop\CodingStudyStuff\web_study-master\JS\Inflearn\React\Node_React_Psyche\Crawling\aladin.py", line 13, in <module>
print(dom.text)
UnicodeEncodeError: 'cp949' codec can't encode character '\xa0' in position 778: illegal multibyte sequence
# -*- encoding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
url = "https://www.aladin.co.kr/m/msearch.aspx?SearchWord=%EC%8B%A4%EC%A1%B4%EC%A3%BC%EC%9D%98&SearchTarget=All"
# 2. request, response
response = requests.get(url)
print(response)
dom = BeautifulSoup(response.content, "html.parser")
print(dom.text)
add below code
# -*- encoding: utf-8 -*-
import sys
import io
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')