2011年11月22日

python对配置文件对中文转换Unicode编码

摘要: 最近需要对Pentaho国际化,其中需要配置properties文件,要将里面的中文用Unicode十六进制表示,以下是python实现代码。只对等号后面的字符做转换。文件名从命令行传入。 1 #!/usr/bin/python 2 # -*- coding:utf-8 -*- 3 import re,os 4 import sys 5 reload(sys) 6 7 def decode(filename): 8 # print filename 9 try:10 f = open(filename, 'r')11 except:12 ... 阅读全文

posted @ 2011-11-22 23:51 nwf 阅读(709) 评论(0) 推荐(0) 编辑

导航