最近开发学习Pyton,当加入中文注释时,运行程序报错: File SyntaxError: Non-ASCII character , but no encoding declared; see http://www.python.org/peps/pep-0263.html for details 解决方法: 在Python脚本文件的第一行或第二行添加一句: #coding:gbk 或 #coding:utf- 或 ##-*- coding : gbk -*-…
set fileencoding=gb18030"设置vim输入的编码 set fileencodings=gb18030,...,"打开文档时vim自动匹配可能的编码方式 在python文件头上添加 # -*- coding: gb18030 -*- 告诉python解释器当前的编码方式 vim -r filename…
我们要做python开发,我想python中的代码风格我们有必要了解一下 这样对我们自己和他们所编写的代码都有好处的. 下面是8点重要代码风格注意事项: ONE : Use 4-space indentation, and no tabs.--用4个空格键进行代码缩进,不要使用tab键. 4 spaces are a good compromise between small indentation (allows greater nesting depth) and large indenta…