S
S
Sergey Karbivnichy2015-12-10 23:55:00
Python
Sergey Karbivnichy, 2015-12-10 23:55:00

How to display cyrillic html page in python3?

I'm trying to load an html page and display it in the console with the following code:

import urllib.request
page = urllib.request.urlopen("http://ex.ua").read()
print (page)

The page is displayed, but instead of Russian characters, this is:
6aad10084b6c47808d2cfaf799923f1b.png
Already googled, tried many ways, but nothing happened.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2015-12-11
@hottabxp

print(urllib.request.urlopen("http://ex.ua").read().decode('utf-8'))

better use docs.python-requests.org/en/latest
import requests
requests.get('http://ex.ua').text

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question