', '.join(Interface.result)
pyTony
pyMod
6,304 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
How about to change
Interface.result=query.capitalize(),':',ab.book[query]
from tuple to
Interface.result=query.capitalize()+':'+' ,'.join(ab.book[query])
pyTony
pyMod
6,304 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
Did you check the size of file, maybe it have been truncated to 0 length (eg opened for writing and closed without writing).
pyTony
pyMod
6,304 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
You must save it again or restore from backup, I think. You could try to put reading the old pickle inside try.. except EOFError: # make empty dictionary block.
pyTony
pyMod
6,304 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
I meant you let normal saving routine to do the saving
import pickle
try:
f=open('ABOOK.dat','rb+')
adb=pickle.load(f)
ab=AddressBook(adb)
except EOFError:
adb={}
ab=AddressBook(adb)
pyTony
pyMod
6,304 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
pyTony
pyMod
6,304 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
Question Answered as of 1 Year Ago by
pyTony