Answer the question
In order to leave comments, you need to log in
Problems with encoding in Python 3?
I write in python webdriver, the program enters the site, copies the text from the body and displays it on the command line. I checked it on two sites, on one everything worked without problems, but on the one it needs it does not work and such an error pops up, while both have the meta charset = "utf-8" encoding:
Traceback (most recent call last):
File "ah.py", line 40, in <module>
print (t.text)
File "C:\Python34\lib\encodings\cp866.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u27a1' in position
403: character maps to <undefined>
Answer the question
In order to leave comments, you need to log in
The console is encoded cp866. It is hemorrhoid to change it, it's easier to write a log to a file. And more correctly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question