Search code examples
pythonnetwork-programminglanpython-class

Is there a way to convert a python class into bytes?


I want to send a python class from one computer to the other. In order to send data, it must be in byte form. I know I can do this with dictionaries, but I was wondering if there is a way to convert a class into bytes? I'd prefer to use something other than pickle, because I need something that is fast and efficient.

Thanks


Solution

  • You should take a look at pickle or jsonpickle. Those are the simplest libraries for Python serialization.