Once there are Chinese comments in the code, an error will be reported
Cause
If there are non ASCII characters in the file, you need to specify the encoding Declaration on the first or second line
Solution
Add such a sentence in the first or second line
# — Coding: UTF-8–
Perfect solution
Similar Posts:
- Solutions to Python Chinese annotation errors
- [Solved] Python pip install Error: SyntaxError: (unicode error) ‘utf-8’ codec can’t decode byte 0xc6
- SyntaxError: Non-ASCII character ‘\xe2‘ in file
- Python Error: Non-UTF-8 code starting with ‘\xe7’ [How to Solve]
- UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-1:
- [Solved] Python Numpy Data load error: Unicode error: unpicking a python object failed: Unicode decodeerror
- Non-ASCII character ‘\xe8’ in file xxx.py on line 8, but no encoding declared
- [Solved] SSH Remote execute Python 3 error: Unicode encodeerror: ‘ASCII’ codec
- Python JSON error json.decoder.jsondecodeerror Chinese
- [Solved] Python Error: UnicodeDecodeError: ‘gb2312’ codec can’t decode byte 0xa4 in position… : illegal multibyte sequence