参考菜鸟教程
在使用python
输出中文会报这样的错误
File "test.py", line 2
SyntaxError: Non-ASCII character '\xe4' in file test.py on line 2, but no encoding declared;
解决方法:
只要在文件开头加入 # -*- coding: UTF-8 -*- 或者 #coding=utf-8 就行了
注意:#coding=utf-8 的 = 号两边不要空格。
#!/usr/bin/python
# -*- coding: UTF-8 -*-
print "你好,世界";
运行正常