Use notepad ++ to learn python crawlers and print Chinese garbled characters on webpages,

Source: Internet
Author: User

Use notepad ++ to learn python crawlers and print Chinese garbled characters on webpages,

Today, when I learned how to use python crawlers, I found that the Chinese characters on the crawled web pages are garbled. I searched for a solution on the Internet one by one and tried it one by one. Then I started to test it using other methods, it is normal to use the editor that comes with python to open it. I found that it is a problem with the notepad ++ editor. I changed the encoding method to UTF-8 without bom and tried all the settings, and it was useless, new, open the file is always in ansi format by default, pynpp quick open. py-format plug-ins have been running garbled characters. Although the root cause of the problem is not found, the code is correct, mainly due to some minor problems in this editor.

However, Baidu later found that if it is garbled, the simplest thing is to add # coding = UTF-8 at the beginning of the file, which can basically solve the garbled problem.

I don't know how to write my first blog. I want to record what I have learned for the time being. I hope I can make some progress and say "come on" to myself.

 

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.