由于编码的缘由,若是直接用: html
print "你好!";
SyntaxError: Non-ASCII character '\xe4' in file C:/Users/*/PycharmProjects/HelloWorld/HelloWorld.py on line 4, but no encoding declared; see http://www.python.org/peps/pep-0263.html for detail python
上面的连接给了解决方案,只要在文件开头加上这么一句: 编码
# -*- coding: utf-8 -*-
每次添加很麻烦,因此能够把它写进模板里面,一劳永逸。模板修改在:file->setting->file and code templatea ->python script 。修改完是这样的效果 : code