Python Crawler series: Several methods to judge the target page encoding

Source: Internet
Author: User

When crawling page content, it is important to understand the encoding used by the target site, and this article describes several common methods and uses several sites for simple testing.

Code Run Result:

From the test results of several websites in different countries, UTF8 use more (for pure English site, in what way decoding no essential difference). However, the success rate of the method 3 and 4 is higher, but the speed is slightly slower, the better method is the combination of these methods, combined with the exception handling structure, priority to use Method 1 or 2, it is not possible to use the latter method. Http://www.aibbt.com/a/18106.html

Collecting and hiding

Python Crawler series: Several methods to judge the target page encoding

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.