', '.join(Interface.result)
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
How about to change
Interface.result=query.capitalize(),':',ab.book[query]
from tuple to
Interface.result=query.capitalize()+':'+' ,'.join(ab.book[query])
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
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
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
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
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
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
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852