Updating Binary File Content
Updating Binary File Content
def createFile():
f=open("Book.dat","wb")
record=[]
ch='Y'
while ch=='Y' or ch=='y':
BookName=input("Name :")
Author = input("Author:" )
Price = int(input("Price : "))
rec=[BookName,Author,Price]
record.append(rec)
ch=input("Do you want to add more records....?Enter(Y/N) : ")
pickle.dump(record,f)
f.close()
print("File is saved.")
#update
f=open("Book.dat","rb")
x=pickle.load(f)
createFile()