The problem with Pickle is the same as for all other programming language-specific serialization problems, that is, it can only be used in Python, and may be incompatible with each other in Python, so it's okay to save only those unimportant data with pickle and not successfully deserialize it.
#----------------------------serialized Import Pickle dic={' name ': ' Alvin ', ' age ': at $, ' sex ': ' Male '} print (Type (DIC)) #< Class ' Dict ' > J=pickle.dumps (DIC) print (Type (j)) #<class ' bytes ' > f=open (' serialized object _pickle ', ' WB ') # Note is that W is written STR,WB is written bytes,j is ' bytes ' F.write (j) #-------------------equivalent to Pickle.dump (dic,f) f.close () #------------- ------------deserialization of Import Picklef=open (' serialized object _pickle ', ' RB ') Data=pickle.loads (F.read ()) # equivalent to Data=pickle.load (f) Print (data[' age ')
The-pickle of the Python module