This produces an error:
pickle.load() takes one positional argument (2 given)
Here is my code:
import pickle, os.path
created = False
phoneBook = {}
name = input("Please enter a name(or press enter to end input): ")
while name != '':
number = input("Please enter number: ")
phoneBook[name] = number
name = input("Please enter a name(or press enter to end input): ")
if name == '':
print("Thank You!")
print("Your phonebook contains the following entries:")
for name, number in phoneBook.items():
print("%s - %s" % (name, number))
while not created:
if not os.path.isfile('phonebook.json'):
phoneBook_Ori = pickle.load('phonebook.json', 'r')
created = True
else:
phoneBook_Ori = pickle.load('phonebook.json', 'w')
phoneBook_Upd = phoneBook_Ori.update(phoneBook)
phoneBook_Ori.write(phoneBook_Upd)
phoneBook_Ori.close
Why isn't it pickling data?