how to pass a dictionary (including chinese characters) through Queue as is?

ouyang zxo102 at gmail.com
Sat Oct 25 11:36:22 EDT 2008


Hi everyone,
    As indicated in the following python script, the dictionary b has
Chinese characters: "中文". But a.get() returns the dictionary with a
little bit different format for the "中文“:   '\xd6\xd0\xce\xc4' . How
can I get the dictionary through the Queue as is?

>>> import Queue
>>> a = Queue.Queue(0)
>>> b = {'a':'中文','b':1232,'c':'abc'}
>>> a.put(b)
>>> c = a.get()
>>> c
{'a': '\xd6\xd0\xce\xc4', 'c': 'abc', 'b': 1232}

Cheers.

Ouyang



More information about the Python-list mailing list