Okay just started teaching myself python recently and am on to pickling stuff. I just wrote a simple program exactly like the tutorial said (a few different ones actually) and I am getting an error. Here is my code:
import pickle file = open('./text/pickle.txt','w') list = ['one',2,'three',4,'five'] pickle.dump(list, file) file.close
and here is the error I am getting:
Traceback (most recent call last): File "E:/python_sandbox/pickle.py", line 7, in <module> pickle.dump(list, file) File "C:\Python31\lib\pickle.py", line 1354, in dump Pickler(file, protocol, fix_imports=fix_imports).dump(obj) TypeError: write() argument 1 must be str, not bytes
Please help. I can't seem to figure out where I am going wrong.