顯示中文報錯
F:\Python27>hello.py ?File "F:\Python27\hello.py", line 14 SyntaxError: Non-ASCII character '\xe9' in file F:\Python27\hello.py on line 14, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details 這個問題怎么辦?
F:\Python27>hello.py ?File "F:\Python27\hello.py", line 14 SyntaxError: Non-ASCII character '\xe9' in file F:\Python27\hello.py on line 14, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details 這個問題怎么辦?
2018-03-30
舉報
2018-03-30
你代碼中肯定出現中文了吧,在文件第一行加
# -*- coding: utf-8 -*-
指定編碼格式為utf-8,就可以支持中文了。