''' Created on Apr 27, 2016 @author: yeshaoting '''
if __name__ == '__main__': print'你好,python!'
三、问题
python脚本里包含有中文时,报如下错误:
1 2 3 4 5 6 7
Traceback (most recent call last): File "/Applications/STS.app/Contents/Eclipse/plugins/org.python.pydev_4.5.5.201603221110/pysrc/pydevd.py", line 1529, in <module> globals = debugger.run(setup['file'], None, None, is_module) File "/Applications/STS.app/Contents/Eclipse/plugins/org.python.pydev_4.5.5.201603221110/pysrc/pydevd.py", line 936, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/Users/yeshaoting/java/workspace/python-workspace/HelloPython/base/HelloWorld.py", line 8 SyntaxError: Non-ASCII character '\xe4'in file /Users/yeshaoting/java/workspace/python-workspace/HelloPython/base/HelloWorld.py on line 8, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details