Python脚本文件中使用中文
时间:2014-03-18 11:48:35
收藏:0
阅读:511
Python做图形用户界面(GUI)开发时经常要在界面上显示中文,需要做如下处理(详见[1]和[2]2.3节):
-
在py文件的首行写上:# -- coding:utf-8 --
-
保存py文件时要存为utf-8格式文件。
[1] Python2.6 Documentation: The Python Language Reference: 2.1.4 Encoding declarations
[2] 孙广磊,征服Python—语言基础与典型应用,北京:人民邮电出版社,2007
Python脚本文件中使用中文,布布扣,bubuko.com
原文:http://www.cnblogs.com/darkmatter/p/3606835.html
评论(0)