import pickle hello="hello" pickle.dump(open('file.txt', 'wb'), hello) print (hello) hi=pickle.load(open('file.txt', 'rb')) print (hi)
File "/home/ubuntu/workspace/tests.py", line 7, in <module> pickle.dump(open('file.txt', 'wb'), hello) TypeError: file must have a 'write' attribute
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)