Article From:

Before thinking about the writing of CSDN and the blogosphere more suitable for yourself, it was found that the blogosphere was more suitable for yourself (mainly because he was more focused on blogs, using it to write a blog more naturally and fluently). My first blog theme is to solve the Chinese garbled code of Python.

Before I want to climb the content of the ordinary world novel, I suddenly found the Chinese chaotic code, think of several ways or not, and finally to the vast number of netizens, find a better way to share with you. For other questions, please refer to this blog:

This is my code:

import requests
import chardet
from  bs4 import  BeautifulSoup

#Crawl the target page
#The head part does not use this part.


r.encoding='gbk2312'        #After you get the webpage, the encoding format GBK is traditional, and gbk2313 is simplified.


View Code

There are two codes used in the code. After examination, only the first encoding is effective (sorry, the first time it will not be changed). The code is clearly marked. If there is any doubt, you can leave a message for me to solve together.

Link of this Article: Essays

Leave a Reply

Your email address will not be published. Required fields are marked *