I get to the bytes of data format is like this:
Choose decoding format before I looked, also specially to the original website shows that utf-8 encoding format, everything is normal, the original web page display content is no problem,
But when I returned to the python on one input decoding instruction, program error...
Online see have said that the second parameter is set to 'ignore', trying to appear after a bunch of gibberish, utf-8 cannot really decoding, where is the problem?
Please, advice!
CodePudding user response:
You this problems can consider return what is the encoding of a print the contents of the response. The ecoding, look at whether the utf-8Headers, and have a look at your requests the inside of the parameters is a accept, and compare the browser is the same
CodePudding user response:
Your process is correct, just in the console output, the console running environment code coding and youTry code with the
import sys
Reload (sys)
Sys. Setdefaultencoding (' utf-8)