Save a class into a binary file - Python

后端 未结 2 500
萌比男神i
萌比男神i 2020-12-31 22:45

I\'m aware that saving a class into a binary file in c++ is possible using:

file.write(Class_variable, size_of_class, amount_of_saves, file_where_to_save)
         


        
2条回答
  •  借酒劲吻你
    2020-12-31 22:59

    You can get at the bytes of Python objects to save & restore them like that, but it's not easy to do directly. However, the standard pickle module simplifies the process enormously.

提交回复
热议问题