【python】"no encoding declared"error in python

来源:互联网 发布:自动卸载软件 编辑:程序博客网 时间:2024/06/05 17:55
1.error:
SyntaxError: Non-ASCII character '\xe7' in file ./class.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

2.proposed Solution:

I propose to make the Python source code encoding both visible andchangeable on a per-source file basis by using a special commentat the top of the file to declare the encoding.

To make Python aware of this encoding declaration a number ofconcept changes are necessary with respect to the handling ofPython source code data.


3.method:

#coding=utf-8 

or:

# -*- coding:utf-8 -*-

4.for more details:

see python官网指导:link

0 0
原创粉丝点击