I have the following code in VSCode:
from bs4 import BeautifulSoup
import urllib.request
req = urllib.request.urlopen('https://www.ua-football.com/sport')
html = req.read()
soup = BeautifulSoup(html, 'html.parser')
news = soup.find_all('li', class_='liga-news-item')
When printing news
it gives me an error:
UnicodeEncodeError: 'charmap' codec can't encode characters in position 726-730: character maps to <undefined>
If I try to encode html
or soup
to utf-8 I will be unable to use find_all
method. I literally went across the whole internet but haven't found a solution. Is there a way?