0
from bs4 import BeautifulSoup
import requests
headers = {"User-Agent":"***********************"}
urls =  "https://www.website.com/en"
respond = requests.get(urls, headers=headers)
assert respond.status_code==200
simple_data = BeautifulSoup(respond.content, "html.parser") 

def find_item_body():
  locator = 'body'
  body_items = simple_data.select_one(locator)
  print(body_items)
if __name__ == '__main__':
  find_item_body()

我得到了下一个错误:

UnicodeEncodeError: 'charmap' codec can't encode character '\u011b' in position 69412: character maps to <undefined>

PS:我已经尝试过使用encode =“utf-8”和“windows-1252”,但我总是遇到同样的错误

4

0 回答 0