python中出现eof错误_python raise EOFError 错误

#!/Users/yicheung/Documents/#Filename:Untitled.pyimportpickleimportosifos.path.exists(r'/Users/yicheung/Documents/address.data')==False:#ifexistsreturnTrue,elseifFalsef=o...

#!/Users/yicheung/Documents/

# Filename: Untitled.py

import pickle

import os

if os.path.exists(r'/Users/yicheung/Documents/address.data') == False:

#if exists return True, elseif False

f = open('/Users/yicheung/Documents/address.data','wb')

temp = {'total' : 0}

#creat a dictionary

pickle.dump(temp, f)

#insert temp into f

else:

pass

def add():

f = open('/Users/yicheung/Documents/address.data','rb')

a = pickle.load(f)

f.close()

b = 0

name = input('Please enter the name of the contact to add:')

for ke

你可能感兴趣的:(python中出现eof错误)