#!/usr/bin/python
#Filename:test1.py
age = 30
name = "Bill"
print "%s is %d years old"%(name,age) #中文
加 #-*- encoding:utf-8 -*- 有的把en去掉也试了!
加上中文注释后运行就出错!
SyntaxError: Non-ASCII character '\xe4' in file test1.py on line 6, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
.vimrc
set encoding =utf-8
set fileencoding=utf-8
language messages zh_CN.utf-8
set fileencodings=ucs-bom,utf-8,gbk,cp936,gb2312,big5,euc-jp,euc-kr,latin1
let &termencoding=&encoding
我用的是Ubuntu11.10