import pickle
def accept():
with open('xyz.dat','wb') as f:
pickle.dump('Hi there',f)
pickle.dump(12345678,f)
pickle.dump(('ek','do','teen'),f)
pickle.dump(['un','dos','tres'],f)
pickle.dump({1:'one',2:'two',3:'three'},f)
def display():
with open('xyz.dat','rb') as f:
for i in range(5):
rec=pickle.load(f)
print(rec)
#rec=pickle.load(f)
accept()
display()
No comments:
Post a Comment