博客园 :: :: 博问 :: 闪存 :: 新随笔 :: :: :: 管理 ::

#coding:utf-8

'''主要是unichr()函数。以下数组中的元素转换后为繁体中文,若不加encode("GB18030")就不能正确显示,而且会报错:('gbk' codec can't encode character u'\ue5fa' in position 0:illegal multibyte sequence)'''

str1=[58874,12417,58859,12417,58896,57809]

for x in str1:
    print unichr(x).encode("GB18030"),

  

posted on 2014-12-04 22:38  #include<stdio.h>  阅读(1214)  评论(0编辑  收藏  举报