def UpdateBook(self, Field, FieldType): if FieldType == 'Name': Book.UpdateName(self, Name) elif FieldType == 'Author': Book.UpdateMobileNo(self, Author) Library.SaveFile() Library.LoadFile()
def SaveFile(): Book.SaveFile() LibCard.SaveFile() file = "LC22_HW1_LibraryClass.txt" f = open(file, "wb") pickle.dump(Library.BookAndLibCardsAssoc, f) f.close()
def LoadFile(): Book.LoadFile() LibCard.LoadFile() file = "LC22_HW1_LibraryClass.txt" f = open(file, "rb") Library.BookAndLibCardsAssoc = pickle.load(f) f.close()
def AddBook(self, Name, Author): Book(Name, Author) Library.SaveFile() Library.LoadFile()