This error is the mistake of beginners, and pay attention when writing code:
Python defaults to ASCII as an encoding method. If you contain Chinese (or other non-English language) in your own Python source code (even the notes), even if you write yourself Python source file with UTF- 8 format is saved, but in fact, this is still not
The first line of the source code file is added:
#coding:utf-8, this can be avoided,
It can also be changed to the first line:
#-_-_ coding: utf-8 _-_-
Note: This statement must be added at the first line in the source code.
Several concepts must first figure it out:
# -- coding: utf-8 --in the header - The specified file is UTF-8, then it is said that you can use Chinese or other words.
urepresents "Chinese" is Unicode encoding, which means
cnis not a string but a Unicode.