how to show Chinese Characters in the value set of a dictionary

Nikos Kouremenos nkour at freemail.gr
Sun Jan 1 10:58:55 EST 2006


On Sun, 01 Jan 2006 07:35:31 -0800, zxo102 wrote:

> 
> Hi there,
>       I have a dictionary with values of Chinses Characters. For
> example,
> 
>>>> dict = {}
>>>> dict['c1']="中国一"
>>>> dict['c2']="中国二"
>>>> dict.values()
> ['\xd6\xd0\xb9\xfa\xb6\xfe', '\xd6\xd0\xb9\xfa\xd2\xbb']
> 
> Since the result of dict.values will be inserted into web pages and
> handled by javascript there, I want to show Chinese Characters
> in the list directly like this,
> 
> ['中国一','中国二']
> 
> Anybody knows how to do this?   Thank you very much for your help.
> 
> Ouyang

>>> print "['", dict.values()[0], "']", "['", dict.values()[1], "']"
[' 中国二 '] [' 中国一 ']




More information about the Python-list mailing list