Python报错 Non-UTF-8 code starting with ‘\xef’ in file xxx
Python •
Python报错如下:
SyntaxError: Non-UTF-8 code starting with '\xef' in file C:/Users/yourname/Documents/python/python_test.py on line 10, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
解决办法:
在py文件的最上面加上:
# -*- coding:utf-8 -*-
作为py文件的第一行。
这样就没问题了!