Sending a Dictionary using Sockets in Python?

前端 未结 6 561
悲哀的现实
悲哀的现实 2021-01-12 06:27

My problem: Ok, I made a little chat program thing where I am basically using sockets in order to send messages over a network.

It works great, but when I decided t

6条回答
  •  清酒与你
    2021-01-12 07:03

    You need to serialize your data first. There are several ways to do this, the most common probably JSON, XML and (python specific) pickles. Or your own custom serialization.

    The basic idea is: Serialize your data, send it, receive it, deserialize it again.

提交回复
热议问题