Sending Dictionary via Network

Ben Finney bignose+hates-spam at
Wed Oct 25 01:51:39 CEST 2006

Larry Bates <larry.bates at> writes:

> mumebuhi wrote:
> > Is it possible to send a non-string object from a Python program
> > to another? I particularly need to send a dictionary over to the
> > other program. However, this is not possible using the socket
> > object's send() function.

You want what is called "serialisation": turning a data structure in
Python into a predictable sequence of (usually text) bytes, to turn it
back into an identical data structure at some other point in time.


> You will need to pickle it first and unpickle it on the other end.

There are many serialisation schemes possible; 'pickle' is just one
(and may be the right one in this case).

Others include JSON, marshal, some XML schema, etc.

 \         "A child of five could understand this. Fetch me a child of |
  `\                                           five."  -- Groucho Marx |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list