def read(url, n): import urllib.request file = urllib.request.urlopen(url) contents = file.readlines(n) for items in contents: print(items) 

When working with the Ukrainian text this result:

 b'\xd0\x92\xd0\x90\xd0\x96\xd0\x9b\xd0\x98\xd0\x92\xd0\x86 \xd0\xa7\xd0\x98\xd0\xa1\xd0\x9b\xd0\x90:\t \n' 

How vivest Cyrillic?

    1 answer 1

    Depends on the encoding of the site. In this case, it seems that this is utf-8 encoded in hex.

    Need to decode from utf-8.

     print(items.decode('utf-8')) b'\xd0\x92\xd0\x90\xd0\x96\xd0\x9b\xd0\x98\xd0\x92\xd0\x86 \xd0\xa7\xd0\x98\xd0\xa1\xd0\x9b\xd0\x90:\t \n'.decode('utf-8') //ВАЖЛИВІ ЧИСЛА:\t \n