def modify(self,x,y,z): t=int(input("Enter the ISBN number of the book you want to issue:")) with open(x,"rb") as f: while(1): try: obj=pickle.load(f) for i in obj: if i.isbn == t: p=int(input("Enter the number of copies:" )) if(i.cp>=p): i.cp=i.cp-p b=Book() b.Booki(z,y,p,t) else: print("Dont have enough copies!") else: print("Invalid ISBN There is no book") except EOFError: break with open(x,"wb") as f: pickle.dump(obj,f)