L
L
lavrik_andrey2018-03-10 20:39:40
Python
lavrik_andrey, 2018-03-10 20:39:40

Parsing pages with BeautifulSoup. Why doesn't it recognize Cyrillic?

Greetings. I'm trying to get the content of the page https://www.yandex.ru/

from urllib.request import urlopen
from bs4 import BeautifulSoup

html_doc = urlopen('https://www.yandex.ru/').read()
soup = BeautifulSoup(html_doc, "html.parser")
 
print(soup)

But an error pops up on the console:
5aa417e78d1f9575127686.png
for example, print(soup.h1) will already work:
5aa4181c45b55326112385.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question