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.