Unit-IV - File Handling - Pickle Module
Unit-IV - File Handling - Pickle Module
file=open(“stu.dat”,”rb”)
file.close()
In order to write an object on to a binary file, use dump()
function of pickle module.
pickle.dump(<object-to-be-written>,<file handle-of-open-file>)
In order to write an object on to a binary file, use load()
function of pickle module.
<object>=pickle.load(<file handle-of-open-file>)