Python 3 uses UTF-8 format by default
Generally, you don’t need to add a word at the beginning– coding:utf-8 —
However, in some Chinese, there will still be unrecognizable cases, and the error of “non-utf-8 code starting with” \ \ xe7 “will be thrown. At this time, you need to add this sentence in the first line.
#-*- coding:utf-8 -*-
Read More:
- [Solved] SyntaxError: Non-UTF-8 code starting with ‘\xe6‘ in file
- SyntaxError: Non-ASCII character ‘\xe5‘ in file [How to Solve]
- [Exception]’ascii’ codec can’t decode byte 0xe8 in position 2: ordinal not in range(128)
- How to Solve Pytorch DataLoader Loading Error: UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xe5 in position 1023
- [Solved] SyntaxError: (unicode error) ‘utf-8’ codec can’t decode byte 0xbe in position 0
- SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3: truncated \UX
- [Solved] Error starting proxy server: oserror (10013), “an attempt was made to access the socket in a way that the access permission is not allowed.”, None, 10013, None)
- [Solved] SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 10-11: malformed
- SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3: truncated \UX
- [Solved] SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 6-7: malformed
- Python Error: SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3:
- [Solved] YOLOv5 Error: SyntaxError: EOL while scanning string literal
- Chromdriver Install error: File “C:\python37\lib\site-packages\selenium\webdriver\common\service.py”, line 76, in start stdin=PIPE) File…
- Syntaxerror: unexpected EOF while parsing solution and ideas
- An error is reported in the requirements code of the generated project
- [Solved] SyntaxError: Generator expression must be parenthesized (widgets.py, line 152)
- [Solved] Python operate Kafka error: SyntaxError: invalid syntax
- [Solved] SyntaxError: Generator expression must be parenthesized
- Python Error: SyntaxError: ‘break‘ outside loop
- [Solved] Ubuntu18.04 Install pyqt5 error: Command “python setup.py egg_info“ failed with error code 1 in /tmp/pip-build-92