Home > other >  Python crawler problems
Python crawler problems

Time:10-28

Bosses for help all of you! The younger brother in urllib crawl when snowball network the stock data to a decoding problem, always don't understand what the reason is,

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-8
Headers, 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 you
Try code with the
 import sys 
Reload (sys)
Sys. Setdefaultencoding (' utf-8)

  • Related