On Sat, 25 Oct 2008 08:36:22 -0700 (PDT), ouyang <zxo102@gmail.c omwrote:
Try printing b before you put it into the Queue.
The Queue isn't doing anything to the objects you pass through it,
you're just surprised at how repr() is presenting the un-altered
data.
Jean-Paul
>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\x c4' . How
>can I get the dictionary through the Queue as is?
>
>{'a': '\xd6\xd0\xce\x c4', 'c': 'abc', 'b': 1232}
>
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\x c4' . How
>can I get the dictionary through the Queue as is?
>
>>>import Queue
>>>a = Queue.Queue(0)
>>>b = {'a':'䏿–‡',' b':1232,'c':'ab c'}
>>>a.put(b)
>>>c = a.get()
>>>c
>>>a = Queue.Queue(0)
>>>b = {'a':'䏿–‡',' b':1232,'c':'ab c'}
>>>a.put(b)
>>>c = a.get()
>>>c
>
The Queue isn't doing anything to the objects you pass through it,
you're just surprised at how repr() is presenting the un-altered
data.
Jean-Paul