SyntaxError: Non-ASCII character '\xe2' in file意思是说,在文件中存在非ASCII字符;
ASCII是8位即一个字符,一共256个字符,随着计算机的发展,现在已经用到2个或者4个字符;
建议在【文件头】追加:
- 123
# -*- coding: cp936 -*-
或者
# -*- coding: utf-8 -*-
或者#coding=utf-8 更复杂的形式要进行编码和解码。
相关文章
- 01-22【Python】SyntaxError: Non-ASCII character '\xe8' in file
- 01-22Python报错:SyntaxError: Non-ASCII character '\xe5' in file 1.py on line 6, but no encoding declared...
- 01-22Python问题:SyntaxError: Non-ASCII character '\xe2' in file
- 01-22Python报错:SyntaxError: Non-ASCII character '\xe5' in file的解决方法
- 01-22Python 类似 SyntaxError: Non-ASCII character '\xc3' in file
- 01-22SyntaxError: Non-ASCII character '\xe6' in file解决方法
- 01-22SyntaxError: Non-ASCII character '\xe5' in file……
- 01-22【Error】Python:SyntaxError: Non-ASCII character '\xe5'解决方法
- 01-22python2.7报错Non-ASCII character '\xe5' in file knn.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
- 01-22python下运行报"SyntaxError: Non-ASCII character '/xe6' "错误解决方法