Life is short, you need Python

Python之中文识别

若python文件中出现中文字符,运行时会出现如下错误

SyntaxError: Non-ASCII character '\xd5' in file sort.py on line 2, but no encodi
ng declared; see http://www.python.org/peps/pep-0263.html for details

可以在python的文件开始处加入下面声明即可fix这个error

# -*- coding: gbk -*

posted @ 2011-04-27 17:25  runfox545  阅读(2439)  评论(0编辑  收藏  举报
白月黑羽 Python教程 白月黑羽Python