Language: python3.4
Text Editor: notepad++
Error:syntaxerror: (Unicode error) ' Utf-8 ' codec can ' t decode byte 0xb4 in position 0:invalid start byte
Description: Use the notepad++ editor to write Python programs. When using a three-quote "' Chinese string, for example (' ' Medium ' size '), then run the error.
Experimental resolution process:
Error procedure:
Create the file test.py. Python code:
- #!/usr/bin/env python
- #-*-Coding:utf-8-*-
- ‘‘‘
- Medium size
- ‘‘‘
Operation Error:
- E:\Program files\python3. 4\01jobs>python test.py
- File "test.py", line 9
- " "
- SyntaxError: (Unicode error) ' Utf-8 ' codec can ' t decode byte 0xb4 in position 0:
- Invalid start byte
Basics: The default encoding format in Python is utf-8.
Solution to the problem:
Use notepad++ to open test.py discovery file storage format is ANSI
Just change the format of the saved file to UTF-8.
Open test.py >> menu bar with notepad++ only encoding (encoding) >> Convert to UTF-8 (converted to utf-8)
In the run test.py problem resolution
notepad++ Editor write Python pay attention to using UTF-8 encoding