UnicodeEncodeError: 'charmap' codec can't encode characters

后端 未结 8 707
感情败类
感情败类 2020-11-22 11:55

I\'m trying to scrape a website, but it gives me an error.

I\'m using the following code:

import urllib.request
from bs4 import BeautifulSoup

get =          


        
8条回答
  •  無奈伤痛
    2020-11-22 12:48

    For those still getting this error, adding encode("utf-8") to soup will also fix this.

    soup = BeautifulSoup(html_doc, 'html.parser').encode("utf-8")
    print(soup)
    

提交回复
热议问题