I'm trying to store a dictionary into a file.
This is part of my code:
Accounts={}
if username not in Accounts:
Accounts[username]=password
database=open("my_mail_database", "w")
pickle.dump(Accounts, database)
database.close()
And I always get this error:
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1538, in __call__
return self.func(*args)
File "C:\Python34\python 3.4\my_gmail2.pyw", line 51, in submit_account
pickle.dump(Accounts, database)
TypeError: must be str, not bytes
Can someone tell me whats the problem with my code?