摘要: 字符串编码常用类型:utf-8,gb2312,cp936,gbk等。python中,我们使用decode()和encode()来进行解码和编码在python中,使用unicode类型作为编码的基础类型。即 decode encodestr ---------> unicode --------->stru = u'中文' #显示指定unicode类型对象ustr = u.encode('gb2312') #以gb2312编码对unicode对像进行编码str1 = u.encode('gbk') #以gbk编码对unicode对像进行 阅读全文
posted @ 2012-04-19 17:33 Goodpy 阅读(117867) 评论(5) 推荐(7) 编辑