By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,592 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,592 IT Pros & Developers. It's quick & easy.

Re: how to pass a dictionary (including chinese characters) throughQueue as is?

P: n/a
On Sat, 25 Oct 2008 08:36:22 -0700 (PDT), ouyang <zx****@gmail.comwrote:
>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}
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
Oct 25 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.