Reptile Chinese garbled solution

Today, I practiced crawling to crawl webpage wallpapers, and found that the title attribute of the obtained pictures was Chinese garbled characters. I went to the Internet to find the following two methods. I hereby record it, so as not to forget it next time.

method 1

(node ​​↓) (node ​​↓)
imgName = imgName.encode('iso-8859-1').decode('gbk')

Method 2

response = requests.get(url)
response.encoding='utf-8' or response.encoding='gbk'
method 2 portal

Guess you like

Origin blog.csdn.net/Vixcity/article/details/109309234