python编码

File "test.py", line 2

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

如果运行python脚本过程中出现如下问题:可以在文件开头加入:

# -*- coding: UTF-8 -*-  或者:#coding=utf-8

你可能感兴趣的:(python编码)